Results 1 to 3 of 3

Thread: [2005] drawing

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2006
    Posts
    719

    [2005] drawing

    how can make a drawing in vb, using mouse or any e-ballpen to add my signature?

  2. #2
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: [2005] drawing

    Not exactly sure what you are asking. Do you want to know how to make a control in VB.NET that lets you use the mouse to draw on it like the pencil-tool in MSPaint?
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  3. #3
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2005] drawing

    If you are trying to do what Jenner said, a mspaint like control, you can use a picturebox and its mousemove event. Make sure you create a new bitmap for your picturebox.image before you call this code, or you'll get an error.
    Code:
        Dim prevX As Integer = -1
        Dim prevY As Integer = -1
        Private Sub PictureBox2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox2.MouseMove
            If e.Button = Windows.Forms.MouseButtons.Left Then
                Dim g As Graphics = Graphics.FromImage(PictureBox2.Image)
                If prevX > 0 And prevY > 0 Then
                    g.DrawLine(Pens.Blue, e.X, e.Y, prevX, prevY)
                    PictureBox2.Refresh()
    
                End If
                prevX = e.X
                prevY = e.Y
            Else
                prevX = -1
                prevY = -1
            End If
        End Sub

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