Visual Basic.NET - Ejemplo de double buffer para eliminar parpadeo

   
Vista:

Ejemplo de double buffer para eliminar parpadeo

Publicado por Angel1970Vcia (1 intervención) el 13/08/2008 08:52:52
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim currentContext As BufferedGraphicsContext = BufferedGraphicsManager.Current
Dim myBuffer As BufferedGraphics = currentContext.Allocate(Me.CreateGraphics, New Rectangle(5, 5, 110, 90))

Dim f As Integer
For f = 1 To 500
myBuffer.Graphics.FillRectangle(Brushes.White, 5, 5, 110, 90)
myBuffer.Graphics.FillEllipse(Brushes.BlueViolet, 10, 10, 100, 80)
Next
myBuffer.Render(Me.CreateGraphics)
myBuffer.Dispose()
currentContext.Dispose()

Dim g As Graphics = Me.CreateGraphics
For f = 1 To 500
g.FillRectangle(Brushes.White, 200 + 5, 5, 110, 90)
g.FillEllipse(Brushes.BlueViolet, 200 + 10, 10, 100, 80)
Next
g.Dispose()

End Sub

End Class
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder