patrick
11/23/2004 4:05:00 AM
Hi Ng,
i have a grid which has to be painted on a panel. This panel serves as an
editor to add controls. The grid consists of horizontal and vertical lines,
illustrated with dots (by the way, how can I draw dots, the line shown below
consists of two dots). If I write an algorithm like this
for (int i = 0; i < this.Width; i += this.GridEntity)
for (int j = 0; j < this.Height; j += this.GridEntity)
{
g.DrawLine(blackPen, i, j, i + 1, j + 1);
}
in the OnPaint method, everything is getting terrible slow. It redraws the
grid every time (of course as it is in the OnPaint method), and deletes my
selection rectangles which I use to illustrate the surroundings of the
control while moved.
How can I write this grid much more efficient? Actually it should look like
in the windows form desginer ;-)
Thanks in advance and best regards
Patrick Braunschweig