Handling redraw and invalid operations:
Re-customizing control behavior and appearance
Void Invalidate (); void Invalidate (Rectangle); // invalidates a specific area of the control and sends a drawn message to the control; void Update (); // causes the control to redraw an invalid area within its workspace; void Refresh (); // equivalent to This.invalidate (true); Update ();
Dual Buffering Technology:
when the amount of data is large, the drawing may take a few seconds or longer, and sometimes flicker occurs, in order to solve these problems, you can use a double buffering technology to draw. Double buffering creates an object in memory that is consistent with the screen drawing area, drawing the graphic to the object in memory, and then copying the graphics on the object to the screen at once, which can greatly speed up the drawing. ;
1. Create a "virtual canvas" in memory;
New Bitmap (+);
2. get the Graphic reference for this memory canvas;
Graphics g = graphics.fromimage (BMP);
3. draw on this piece of memory canvas;
Ten Ten Ten Ten ); G.drawline () g.drawstring ()//...
4. Draw the memory canvas into the window and release the memory buffer;
This 0 0 );
Note: with the doublebuffered attribute in the. NET Framework version 3 , you can use the dual buffering technology directly
Redrawing and double buffering techniques for controls