We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Cell Font Colour

Thread ID:

Created:

Updated:

Platform:

Replies:

24295 Feb 1,2005 04:14 AM Feb 1,2005 05:19 AM Windows Forms 5
loading
Tags: GridControl
Iain
Asked On February 1, 2005 04:14 AM

Hi, I have two cells within a row. I need to change the font colour dependant on their values i.e. if cell1 is less than cell2 then make it''s font colour red etc. Where is the best place to do this. Thanks

Administrator [Syncfusion]
Replied On February 1, 2005 04:33 AM

Try using PrepareViewStyleInfo. When e.RowIndex and e.ColIndex point to the cell you want to potentially color, compare e.Style.CellValue to your grid cell value (gotten by indexing; grid[e.RowIndex, someColIndex].CellValue). Then set e.Style.BackColor to the color based on teh result of the comparison.

Iain
Replied On February 1, 2005 04:41 AM

Hi, Thanks for the super fast response. I have done this and it works well however I would like to change the font colour but can''t find the right property. Many thanks Iain >Hi, > >I have two cells within a row. I need to change the font colour dependant on their values i.e. if cell1 is less than cell2 then make it''s font colour red etc. Where is the best place to do this. > >Thanks

Administrator [Syncfusion]
Replied On February 1, 2005 04:57 AM

Try using e.Style.TextColor.

sukisj@suk.sas.com
Replied On February 1, 2005 05:03 AM

Hi Clay, I tried e.Style.BackColor and it works. When I try e.Style.TextColor it doesn''t. Any ideas? Thanks Iain

Administrator [Syncfusion]
Replied On February 1, 2005 05:19 AM

Instead of PrepareViewStyleInfo, use grid.QueryCellInfo (grid.Model.QueryCellInfo in a GridDataBoundgrid). There are some properties that need to be set in QueryCellInfo instead of PrepareViewStyleInfo. The TextColor property could be used to initialize some type of edit control, and this would need to be set up early.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;