Home - Forums-.NET - FlyGrid.Net (Windows Forms) - setting colour for readonly work in wrong way

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

setting colour for readonly work in wrong way
Link Posted: 12-Dec-2005 22:31
Hello!

Our overridden PaintCellValue method looks in this way.
This method is overriden from DynamicallyAutoDetectDataTypeColumn class.

public override void PaintCellValue(CellDrawInfo dci) //Our modified
version
{
   try
   {
      ExtFlyGridNsp.GridValue gv = (ExtFlyGridNsp.GridValue)GetValue
(dci.node);
      if (gv != null && gv.ReadOnly)
      {
         dci.customBackColor = Color.Gray;
      }
   }
   catch(System.Exception e )
   {
   }

   base.PaintCellValue(dci);
}


Now to our problem assume we add some rows to the flygrid
Assume we set one cell to be readOnly. The problem is
that the whole flygrid all the rows and all the column is changed to the
colour specified in the PaintCellValue if at least one cell is defined
to be readOnly. We only want the specified cell and
not the whole row or the whole column to be set accordingly to the
colour in PaintCellValue.
If I use the debugger I can see that the code is doing the right thing
which mean setting the colour only for the cell specified to be readOnly and not for other cells but the result on the screen is saying something else.

Have you any good solution to this problem?




//Tony
Link Posted: 12-Dec-2005 22:36
I'm forget to warn - customBackColor should be cleared, here is correct code:

public override void PaintCellValue(CellDrawInfo dci)
{
  try
  {
    ExtFlyGridNsp.GridValue gv = (ExtFlyGridNsp.GridValue)GetValue
(dci.node);
    if (gv != null && gv.ReadOnly)
    {
      dci.customBackColor = Color.Gray;
    }
  }
  catch(System.Exception e )
  {
  }
  base.PaintCellValue(dci);
  dci.customBackColor = Color.Empty; //Clear custom color
}