Results 1 to 3 of 3

Thread: paint program

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Posts
    4

    Question

    Hi,

    I'm supposed to make a program similar to (microsoft) PAINT. You should be able to make rectangles, lines, circles, ovals, free hand drawings, define color, fill the circle/oval with a color. Also, you should be able to save, open and do all that stuff.

    Does anyone have code or tutorials for such a program? Especially how to make the tools for drawing circles and other shapes. Help me, I'm stuck!!

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Well all you need basically is a picturebox.
    And then some buttons to denote tools.

    When I did something similar to this, I stored a list of everything that had been drawn in arrays.
    Something like :

    Code:
    Private Type Rectangle() As myRect
    Private Type myRect
        TopLeft As myPoint
        TopRight As myPoint
        BottomLeft As myPoint
        BottomRight As myPoint
    End Type
    
    Private Type Circle() As myCircle
    Private Type myCircle
        Centre As myPoint
        Radius As Integer
    End Type
    
    Private Type myPoint
        X As Integer
        Y As Integer
    End Type
    Then, when the user clicks on a tool, you remember what 'mode' you are in. When they move the pointer over the picturebox, you clear it, repaint it with the above shapes (etc.), and then do whatever it is that the 'mode' states.
    For example, if you're in line drawing mode, and they click on the picturebox, you should put a point there. Then every time they move the pointer, you clear the picturebox, redraw the shapes, redraw the point, and draw a line from the point to the pointer. Then when they click again, you would draw that line, and store it in a UDT.

    That help ?

    - jamie
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3
    New Member oBiOnE's Avatar
    Join Date
    Mar 2001
    Location
    ENgland
    Posts
    15

    Talking

    Hi,
    I've attached a program I did at College. It allows:

    • Freehand Drawing
    • Lines
    • Boxes
    • Circles (Needs work!!!)
    • Line widths
    • Fill styles


    Hope this helps,
    Attached Files Attached Files

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