Paint Program -help needed
I have been working on a paint program recently. I want to let the user draw stuff to the form when the left mouse button is clicked. I know how to do this using Creategraphics() method of a graphics object but, I want to use it drawing to a bitmap. I know how to do this to but, its not working in the Mouse_Move Event. I think its got to be in the paint event but that doesnt work either. Here is my code:
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Dim bmp As New Bitmap(Me.ClientSize.Width, Me.ClientSize.Height)
Dim rect As Rectangle
With rect
.X = e.X - 1
.Y = e.Y - 1
.Width = mywidth
.Height = mywidth
End With
If MouseButtons = MouseButtons.Left Then
Dim grfx As Graphics = Graphics.FromImage(bmp)
PictureBox1.Image = bmp
grfx.FillEllipse(mycolor, rect)
End If
End Sub
This doesnt work so can someone tell me how I can get this to work???
Any help is appreciated.
If anymore info is needed let me know.