datagrid on a windows form

  • Thread starter Thread starter ALI-R
  • Start date Start date
A

ALI-R

have a datagrid on a windows form which bound to a dataset ,one column
contains boolean data which datagrid shows checkbox for it .I don't want
checkbox ,instead I want "yes" or "no" and I want "no" columns to be bold
,it is easy to do that on web forms by using prepair event or so on ,but
here in windows form which event or delegate should I use?

thanks for your help
 
Hi,

You will need a custom DataGridColumnStyle for that. First, you will need to
override GetColumnValueAtRow and SetColumnValueAtRow methods to implement
conversion from boolean true/false to strings "Yes/No" and vica versa.

Next, you will have to override the Paint method to draw the "No" values in
bold.

Probably it might be a good idea to derive your column style from
DataGridTextBoxColumn, also see the MSDN docs on
System.Windows.Forms.DataGridColumnStyle.
 
Back
Top