Home - Forums-.NET - FlyGrid.Net (Windows Forms) - ArgumentException

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

ArgumentException
Link Posted: 11-May-2012 06:34
We have four classes

class C1 : Column
{
   public override void PaintCell(CellDrawInfo dci)
        {
         some code
         -------
         -------
         base.PaintCell(dci);
        }
}


class C2 : ButtonColumn
{
   public override void PaintCell(CellDrawInfo dci)
        {
         some code
         -------
         -------
         base.PaintCell(dci);
        }
}

class C3 : HierachyColumn
{
   public override void PaintCell(CellDrawInfo dci)
        {
         some code
         -------
         -------
         base.PaintCell(dci);
        }

}


class C4 : LookupListColumn,IDropDownListService
{
   public override void PaintCell(CellDrawInfo dci)
        {
         some code
         -------
         -------
         base.PaintCell(dci);
        }
}


All these are added to fly grid. And we are intermittently getting the below error at base.PaintCell(dci); line in the above four classes.

ArgumentException was unhandled by user code
Parameter is not valid

Stack Trace:
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
   at System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
   at NineRays.Windows.Forms.Grids.Column.PaintTextInCell(CellDrawInfo dci, Brush bkBrush, Color foreColor)
   at NineRays.Windows.Forms.Grids.Column.PaintCellValue(CellDrawInfo dci)
   at NineRays.Windows.Forms.Grids.Column.PaintCell(CellDrawInfo dci)
   at CapitalIQ.Client.Presentation.CustomLookUpListColumn.PaintCell(CellDrawInfo dci) in C:\SRC\OfficeClient\branches\RC8.60\Excel\CapitalIQ.Client.Presentation\CapitalIQ.Client.Presentation.UI\LinkedItemManager\Columns\CustomLookupListColumn.cs:line 174
   at NineRays.Windows.Forms.Grids.Drawing.GridPainter.3(CellDrawInfo )



Any clue?
Link Posted: 11-May-2012 07:32
Could you provide some demo code (please send it to develop [at] 9rays.net)?
Probably something happens at line 174. Or you can modify your code to embrace it with try-catch block and try to catch the reason of exception.
Link Posted: 22-May-2012 00:28
Modified my code to catch the exception.

The code at line 174 is base.PaintCell(dci);
One thing that I observed is the error is occurring at the last row of first column every time.

If you expand the dci.g in catch block we can see all properties are set to the below error message
Clip   'dci.g.Clip' threw an exception of type 'System.ArgumentException'
ClipBounds   'dci.g.ClipBounds' threw an exception of type 'System.ArgumentException'
--
--
--
Link Posted: 22-May-2012 07:33
Could you send us a sample demonstrating this problem? Seems the problem in some initializing a dci structure code.