Results 1 to 2 of 2

Thread: example of MS Paint ?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2001
    Location
    Ohio, USA
    Posts
    18

    example of MS Paint ?

    I want to make a very simple painting program such as Microsoft's Paint for my 3 year old to play with. Are there any examples or tutorials out there for me to look at, learn a little bit from, and use?

    Thanks for pointing me in the right direction

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Mar 2001
    Location
    Ohio, USA
    Posts
    18
    I found one. I think I got it at http://planet-source-code.com. At any rate, the author is Niall McCurry and I just modified his code for my uses.

    The following code works almost how I want. The only thing is, when the user is holding down the mouse button and drawing, if the mouse does not move at all, nothing is drawn. I'd like to draw a circle (radius 5 to match the line width) as soon as the mouse button is pressed, then if it moves to continue with the LINE command. I tried doing something like:

    if frmDraw.currentX = X then
    frmDraw.circle (X,Y), 5, gColour
    EndIF

    But it didn't work. Any ideas? Specifically see the area "Private Sub Form_MouseMove". Following is the code I am working with, minus all the code for the color buttons (I left one in).

    Option Explicit

    Dim gColour As Double

    Private Sub Form_Load()

    'specify width of line you're drawing
    frmDraw.DrawWidth = 10

    End Sub

    Private Sub cmdNew_Click()
    frmDraw.Refresh
    End Sub
    Private Sub cmdExit_Click()

    Unload frmDraw

    End Sub



    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    'Change X & Y co-ordinated to position where mouse
    'was pressed.

    frmDraw.CurrentX = X
    frmDraw.CurrentY = Y

    End Sub

    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    'If left mouse button was pressed draw a line

    If Button = 1 Then
    Line (frmDraw.CurrentX, frmDraw.CurrentY)-(X, Y), gColour
    End If

    End Sub

    Private Sub cmdBlue_Click()
    gColour = vbBlue
    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