Change Color of Datagrid Column Text

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I am trying to programatically change the forecolor of the text in a textboxcolumn of a datagrid at runtime. The datagridtextboxcolumn is standard, and was assigned as a gridcolumnstyle of the datagrid's tablestyle on form loading
How do I reference the textboxcolumn that I added to the grid to change it's text forecolor
Thanks
JT
 
Hi,

The DataGridTextBoxColumn style does not support change its backcolor or
forecolor. To customize the color on a DataGrid Column Style you need write
your DataGridColumnStyle class and override the Paint method to draw the
column text.
Here is an article on CodeProject.com, I hope it will give you a good
sample for how to write a ColumnStyle:
<Changing the background color of cells in a DataGrid>
http://www.codeproject.com/csharp/custom_datagridcolumnstyl.asp

If you still have problem on this issue, please feel free to reply this
thread.
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
 
Back
Top