We have a custom grid system. Each grid element is made of 4
GoStrokes and a GoRectangle that fills the inside. We use the
GoRectangle to help us with things like MouseOver. We create the
GoRectangle as followed
_CellBackground = new GoRectangle();
_CellBackground.Size = this._GridStructure.Size;
_CellBackground.Position = this._GridStructure.Position;
_CellBackground.Brush = Brushes.Transparent;
_CellBackground.Pen = new Pen(Color.Transparent);
this.InsertBefore(_GridStructure, _CellBackground);
Our app would crash with this stack dump
OnPaint: System.ArgumentException: Invalid parameter used.
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.FillRectangle(Brush brush, Single x, Single y, Single width, Single height)
at Northwoods.Go.GoShape.DrawRectangle(Graphics g, GoView
view, Pen pen, Brush brush, Single x, Single y, Single width, Single
height)
at Northwoods.Go.GoRectangle.Paint(Graphics g, GoView view)
at Northwoods.Go.GoGroup.Paint(Graphics g, GoView view)
at Northwoods.Go.GoLayer.Paint(Graphics g, GoView view, RectangleF clipRect)
at Northwoods.Go.GoView.PaintObjects(Boolean doc, Boolean view, Graphics g, RectangleF clipRect)
at Northwoods.Go.GoView.PaintView(Graphics g, RectangleF clipRect)
at Northwoods.Go.GoView.onPaintCanvas(PaintEventArgs evt)
at Northwoods.Go.GoView.OnPaint(PaintEventArgs evt)
This typically happen when we re-activate the GoView ; ie bring it to
the front. We do not override any of the Paint method so
what could cause this “System.ArgumentException: Invalid parameter
used” error?