I'm working on a project wich kinda involves making some kind of improved "MsPaint" allowing the user to create a few types of figures, using GDI+ in C#. But since that kind of figures and the way to make them (drawLine, drawLines, drawRectangle) just make lines on a bitmap, I can't completely understand how to make a solid object from, for example, a triangle I made using 'drawlines' method.
For now I just simplified the sourcecode from an Addisson Wesley book "Addison Wesley - Graphics Programming With C Sharp And Gdi+" and I'm using it to learn the basics. Thing is, I'm not even sure if this starting point is the correct to ultimately make the program I wanna make, which as I said before, it should let the user to create "figures" or "objects from figures" and rotate, transform, move them around.
The source code is from this actual site:
http://www.c-sharpcorner.com/Store/Books/0-321-16077-0.asp
I only used Chapter 03 "GDI+ Painter" as I think it could help.
Thank you very much in advanced. I attached the simplified version wich only allows to draw simple lines ellipses and rectangles based on the mentioned GDI+ Painter.
Loading

Mahesh ChandRank #1 · 393.3K reputationPosted Sep 1, 2010, 7:05 PM EDT
So
1. Triangle class
2. Three public Point properties - P1, P2, P3
3. Draw method
4. Surface or Canvas property (handle of control that you want this triangle to be drawn on such as a Form or a Panel)
I hope this gives you some starting clues.
Good luck!
Adrian Z9 reputationPosted Sep 1, 2010, 8:29 PM EDT
So I'm not even absolutely sure if using GDI+ and C# is a good starting point to even getting to the final simple product of making a program with the features I mentioned early, actually haha.
EDIT:BTW your book is awesome, although I'm having troubles with this whole "make movable objects thing" I learned a lot with your work.
Felipe RamosRank #1,409 · 1.2K reputationPosted Sep 2, 2010, 6:50 AM EDT
Adrian Z9 reputationPosted Sep 2, 2010, 8:24 AM EDT
Thanks again, and I'll probably be back with more questions later haha.
Mahesh ChandRank #1 · 393.3K reputationPosted Sep 2, 2010, 8:39 AM EDT
Thank you! I am glad you liked my book.
However, If you have a choice, use WPF instead. Drawing support is much much better in WPF than GDI+/Windows Forms. Plus GDI+ has many resource leaks and performance is not good either. Go for WPF.
Adrian Z9 reputationPosted Sep 2, 2010, 9:06 AM EDT
Again, thanks Mahesh for the advice since the main thing I was concerned about was to know whether I was on the right track to accomplish what I ultimately wanted for the project or not. Although I didn't mind learning all the stuff from your book since I'm always at the look of learning new things anyway.
Thanks again for all the trouble.
Felipe RamosRank #1,409 · 1.2K reputationPosted Sep 2, 2010, 9:25 AM EDT
Mahesh ChandRank #1 · 393.3K reputationPosted Sep 2, 2010, 11:13 AM EDT
It that helps, you probably stick with Windows Forms/GDI+. WPF is a learning curve and has lot of new things. IF you do want to learn WPF, check out WPF section of C# Corner.
Adrian Z9 reputationPosted Sep 6, 2010, 6:54 PM EDT
Thing is, can present this mini-project, on December 2010 or February 2011 and I'm still concerned about learning or at least taking good advantage of what Duncan made since it requires a bit of knowledge about the subject.