Resolve the problem of flickering in the drawing.
If you draw in the form, whether you use a dual cache, you will see the picture will constantly flicker when you update, and the solution is to add the following three lines of code in this form of constructor:
Please add the following lines in the constructor: setStyle (ControlStyles.UserPaint, True); setStyle (ControlStyles.allPaintingInWmpAint, true); // Disable the erase background .setStyle (Controlstyles.doublebuffer, true); // Double buffer
Parameter Description:
UserPaint If you are True, the control will draw itself instead of drawing it through an operating system. This style is only applicable to derived from the CONTROL.
AllPaintingINWMPAINT If you are true, the control will ignore the WM_RASEBKGND window message to reduce flashing. This style should be applied only when the UserPaint bit is set to TRUE.
Doublebuffer If you are True, draw in the buffer, and output the result to the screen after completion. Dual buffers prevent flicker caused by the control overlapping. To fully enable dual buffering, you must set the UserPaint and AllPaintingInWmPaint Style Bits to TRUE.
Reference: How to Solve the flashing problem in CSHARP? Http://search.9cbs.net/ExPERT/topic/1488/14888888888. Implementation method of dual-bucking drawing in the xmlc#. Http://blog.joycode.com/ghj/archive/2004/01/03/10543.aspx
You are not drawing on the form, you need to write a control yourself, adding the above three lines of code on this control constructor. Reprint