graphics - Double buffering C# -


I am trying to apply the following method: zero ball: drawon (graphics g);

The method should attract all the previous positions of the ball (stored in the queue) and finally the current spot. I do not know what it means, but I live Using the drawlipers (...), I print the previous locations and present the current position. Use Fill Ellipses (...).

The question is, as you can imagine that many drawings have to be done and in this way the performance starts with very flicker, I have found a way to double the buffer, but I was getting these two ways:

1) System. Windows .form. Control Double-buffed = true;

2) SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);

While trying to use the first time, I get an error explaining that property double buffer is inaccessible with this method because its security level. However how the set style method can be used.

Is it possible to double the buffer, while all access

edit: I created the following class

  Namespace Double Buffer {Classroom buffet: Bowlball: system.indo.form.form {Private Ball Ball; Public buffball (ball ball) {this.ball = ball; } Public Zero Draw (Graphics G) {this.Doublebuffered = true; Int num = 0; Rectangle drawArea1 = new rectangle (5, 35, 30, 100); LinearGradientBrush linearBrush1 = New LinearGradientBrush (drawArea1, Color.Green, Color.Orange, LinearGradientMode.Horizontal); Rectangle drawArea2 = new rectangle (5, 35, 30, 100); Linear BrushesShop Brush Linear Brush 2 = New Rainiergridbrush (Draieria 2, Color. Black, Color. Red, RainierGradientMode. Vertical); Forex currency (point point in the ball) preceding places {pen myPen1; If (number% 3 == 0) myPen1 = new pen (Color.Yellow, 1F); And if (number% 3 == 1) myPen1 = new pen (color green, 2f); Else myPen1 = new pen (color. Red, 3f); Number ++; MyPen1.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid; MyPen1.StartCap = System.Drawing.Drawing2D.LineCap.RoundAnchor; MyPen1.EndCap = System.Drawing.Drawing2D.LineCap.AnchorMask; G. Drylipus (myPen1, (float) (dot.x - ball.rends), (float) (point Y + ball.rends), (float) (2 * ball.radius), (float) (2 * ball .radius )); } If ((ball.Host.ElapsedTime * ball.Host.FPS * 10)% 2 == 0) {g.FillEllipse (linear brush 1, (float) (ball.place.x - ball.radius), (float ) (Ball spot Y + ball radius), (float) (2 * ball radius), (float) (2 * ball. RDI); } And {G. Fill Ellips (linear brush 2, (float) (ball.place X. ball. RDS), (float) (ball spot Y + ball radius), (float) (2 * ball. RDI) (float) (2 * ball.radius)); }}}  

}

And drag the ball looks like this:

  New Bufferball (this). Dracon (G);  

What does this mean? Because it's still playful?

form class has been highlighted as DoubleBuffered property protected . But since you get your form from the form , you can use it.


Comments