Hi everyone,
Actually the code this time is rather large so I decided to attach it as a zip file.
It's a project I started this afternoon (I knew where I wanted to go with it so coding went pretty fast). I have no intentions to update or code more for it, but I wanted to share it as a reference.
The application is a simple vector drawing program on the outside. On the inside it's a little more complicated. But I deliberately didn't use any more "advanced" features of DBP to make the code more understandable. I believe the code gives a good example of how to use User Defined Types, and how to manage them.
I also built this application in a way that makes it very easy to alter things. EG. The layout is not "set" with constants. By changing some values you make the canvas smaller or larger and the amount of code to be changed shouldn't be large.
Everything was coded from scratch.
Picture:
Features include:
* Line, ellipse, circle and bezier curves
* Moving of vector points, and fully changing them
* Connected points are "remembered" (you can connect multiply shapes in a point and they will stay connected)
* Snap to Grid (Grid Size is adjustable, but I didn't make a GUI button for it)
* A canvas
The canvas has its own dimensions, currently set on (left top right bottom): -5.0, 3.6, 5.0, -3.6, the grid size is set on 0.5.
by altering those dimensions you can easily implement a zoom and move canvas feature.
[edit]
I should give some instructions though:
Using the arrow: The arrow is used to move vector points (the blue dots). You can drag them around if you want.
Using Line/Ellipse/Circle: Click once to set the first point, and click somewhere else for the final point. This will add the shape to the drawing list.
Using Bezier Curves: Click and drag to set the first point and draw the anchor of the first point. Then click and drag a second time to set the final point and anchor.
Cheers!
Sven