|
-
Mar 20th, 2001, 08:12 PM
#1
Thread Starter
New Member
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!!
-
Mar 21st, 2001, 03:19 AM
#2
Retired VBF Adm1nistrator
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]
-
Mar 21st, 2001, 04:10 AM
#3
New Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|