1 Attachment(s)
Can't DRAW!!! DAMN FLICKER!!!
excuse my anger, but I AM angry!! :D been playing with this for 2 days and still doesnt work!
This is what my sample app is supposed to do: when the user moves the mouse, it's suppose to draw an alpha blended rectangle over the form's background image. As the mouse moves, the rectangles gets larger or smaller, depending on the mouse position on the form. The problem is that it FLICKERS and it doesnt WORK!!!!! :mad:
Here's what it SHOULD look like:
http://www.vbforums.com/attachment.php?postid=1193160
but it doesnt work. here's my code:
VB Code:
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Dim gr As Graphics = Me.CreateGraphics
Dim rgn As New Region(New Rectangle(0, 20, e.X, Me.ClientSize.Height - 45))
Dim myBrush As New SolidBrush(Color.FromArgb(50, 0, 0, 0))
' THIS EVIL MAKES IT FLICKER!!!!!
' I cant use gr.Clear because it erases the background image
Me.Invalidate()
gr.FillRegion(myBrush, rgn)
gr.Dispose()
End Sub
I have the code in a project, it would be nice if you download it, because you can clearly see what I mean by flicker when you run the app