ic ic

ic ic

  • NA
  • 85
  • 0

DatagridView Disable a Checkbox with a Tick In

Sep 30 2009 6:40 AM

Hi,
I can't seem to make a disabled checkbox in a datagridview  with a tick in where the user can't select & stores a value of 0
I got this off the net but it shows a disabled box with no tick in and no value sored in the background as well even more dissapointing
once the mouseover or mousemove between rows the so called disabled checkbox chnages to enable or state.
On the CellPainting Event:
e.PaintBackground(e.CellBounds, true);
Rectangle r = e.CellBounds;
r.Width = 15;
r.Height = 15;
r.X += e.CellBounds.Width / 2 - 8;
r.Y += e.CellBounds.Height / 2 - 8;
ControlPaint.DrawCheckBox(e.Graphics, r, ButtonState.Flat);
e.Handled = true;
Is there no other way?
Please Assist, Regards

Answers (8)