Results 1 to 3 of 3

Thread: Drawing with Mouse?

  1. #1

    Thread Starter
    Lively Member chongo 2002's Avatar
    Join Date
    Apr 2000
    Posts
    106

    Arrow

    I want to write a really simple program or so I think. All I want to do is draw a line wherever the mouse moves, like clicking and holding in paint and just moving the mouse around.(Without clicking just moving the mouse) I then want to be able to clear the form by a simple click. Any ideas? And Possibly add some color changes in there too?


    Thanks

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Paste this sample code to a form
    Code:
    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        CurrentX = X
        CurrentY = Y
    End Sub
    
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Select Case Button
            Case 1 'left button draws lines
                Line -(X, Y)
            Case 2 'right button changes color
                ForeColor = QBColor(Int(Rnd * 16))
            Case 3 'both buttons clear the form
                Cls
        End Select
    End Sub
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Lively Member chongo 2002's Avatar
    Join Date
    Apr 2000
    Posts
    106
    Thanks works great

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