I would like to write a program that enable user to draw geometric shapes like circles, triangles, rectangles and so on.
I would like also to be able to drag and drop or resize/move a shape that was previously drawn.
But what I don't understand is how to implement the following:
When the mouse is over the circle, the circle is chosen, and then using some key enables the user to resize/move it.
How can I know that the mouse is over the circle ?
Do I need to check the mouse coordinates vs all circle pixel coordinates ?
I'm looking for simpler solution.
Use the WPF Graphics and Multi-media. http://msdn.microsoft.com/en-us/library/ms752061.aspx
Windows Presentation Foundation (WPF) includes support for high quality 2-D and 3-D graphics, animation, and media. Key features of the graphic platform include:
Vector graphic support.
Hardware acceleration.
Resolution and device-independent graphics.
Minimal screen redraw and integrated animation system.
It has everything you need - why re-invent the wheel?
You need to keep the objects as graphical objects themselves, so they can respond to mouseover events. Once you put them into a bitmap, then you are going to have to essentially re-invent the wheel.
For example,
Here's shape objects:
http://msdn.microsoft.com/en-us/library/ms747393.aspx#shapes
Here's hit testing:
http://msdn.microsoft.com/en-us/library/ms752097.aspx
You also get the advantage of hardware acceleration, resolution ad device-independent graphics. I don't think you are going to be able to implement this yourself easily :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With