Results 1 to 3 of 3

Thread: another question on drawing in pic box

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2000
    Posts
    27
    i need some help. What i would like to do is create a drawing tool just like the straight line tool in paint. I have the code to draw the line and erase it everytime the mouse moves, and when the button is released the line is erased. Here is the code i have:

    Option Explicit
    Public A As Integer, B As Integer

    Private Sub picDraw_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    A = X
    B = Y
    End Sub

    Private Sub picDraw_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    picDraw.Cls
    If Button = 1 Then
    picDraw.Line (X, Y)-(A, B), RGB(255, 0, 0)
    End If
    End Sub

    can someone tell me how to keep from erasing the line when the button is released?
    i know it probably has something to do with the MouseUp function

  2. #2
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    try putting it in the mouse Click event instead of mouse down event
    NXSupport - Your one-stop source for computer help

  3. #3
    Guest
    Code:
    Private Sub picDraw_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 
    'picDraw.Cls <-REMOVE
    If Button = 1 Then 
    picDraw.Line (X, Y)-(A, B), RGB(255, 0, 0) 
    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