Hi !
Here's the Class for BackBuffering, It's easy. =)
Code:Public Class IBackBuffer Private mvarBitmap As System.Drawing.Bitmap Private mvarBuffer As System.Drawing.Graphics Private mvarGraphics As System.Drawing.Graphics Private mvarForm As System.Windows.Forms.Form Public Sub Connect(ByVal xForm As System.Windows.Forms.Form) mvarForm = xForm mvarGraphics = mvarForm.CreateGraphics mvarBitmap = New Bitmap(mvarForm.Width, mvarForm.Height) mvarBuffer = Graphics.FromImage(mvarBitmap) End Sub Public ReadOnly Property Graphics() As System.Drawing.Graphics Get Return mvarBuffer End Get End Property Public Sub DoPainting() mvarGraphics.DrawImage(mvarBitmap, 0, 0) End Sub End Class
This is how you use it:
There you go. =)Code:Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim xBackBuffer As New IBackBuffer() 'Connect BackBuffer Component to Form1 xBackBuffer.Connect(Form1) '############################# 'Do Your Graphics Drawing Here '############################# 'You Draw you graphics using xBackBuffer.Graphics 'xBackBuffer.Graphics.* '############################# 'Finally, Flicker Free paint your graphics. xBackBuffer.DoPainting() End Sub





Reply With Quote