Change Color of Datagrid Column Text

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
 
Y

Ying-Shen Yu[MSFT]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top