himanshubari
Newcomer
- Joined
- Mar 14, 2005
- Messages
- 9
Hey,
can somebody help me out to avoid the flickering of controls that I am getting while I mobve them on the forma t runtime.
here is the code I have added to the mouse events for a button I hav on my form
Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown
If e.Button = MouseButtons.Left Then
moving = True
End If
End Sub
Private Sub Button1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseMove
If moving Then
Button1.Location = New Point(e.X, e.Y)
Button1.Refresh()
Button1.Parent.Refresh()
End If
End Sub
Private Sub Button1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseUp
moving = False
End Sub
I also added these lines after the initialize component call to enable double bufferring
Me.SetStyle(ControlStyles.DoubleBuffer, True)
Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
Me.SetStyle(ControlStyles.UserPaint, True)
HELP WILL REALLY BE APPRECIATED
THANKS
can somebody help me out to avoid the flickering of controls that I am getting while I mobve them on the forma t runtime.
here is the code I have added to the mouse events for a button I hav on my form
Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown
If e.Button = MouseButtons.Left Then
moving = True
End If
End Sub
Private Sub Button1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseMove
If moving Then
Button1.Location = New Point(e.X, e.Y)
Button1.Refresh()
Button1.Parent.Refresh()
End If
End Sub
Private Sub Button1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseUp
moving = False
End Sub
I also added these lines after the initialize component call to enable double bufferring
Me.SetStyle(ControlStyles.DoubleBuffer, True)
Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
Me.SetStyle(ControlStyles.UserPaint, True)
HELP WILL REALLY BE APPRECIATED
THANKS