Results 1 to 1 of 1

Thread: Paint Program -help needed

Threaded View

  1. #1

    Thread Starter
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    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.
    Last edited by System_Error; May 22nd, 2004 at 10:56 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width