Click here to Skip to main content
15,887,854 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
How to develop an application which perform to draw line, circle, rectangle etc figures through canvas using user control. it also perform zooming and panning and selection of any figures separately and also combine.
Posted
Comments
Shahin Khorshidnia 19-Apr-12 3:25am    
Hello. 1. Please tell us what is the specific problem? It's a very general question. 2. Please Tag your question. What kind of application? WPF? WinForm? ASP.Net? Silverlight? WinMobile? ... I think you mean WPF but please Tag it (Click on Improve question first). 3. WPF (If you mean it) has some tools for drawing some shapes Like Ellipes, Line, Rectangle.
Sergey Alexandrovich Kryukov 19-Apr-12 3:36am    
Right, this information is critically important. Who would like to give detailed advice for all thinkable combinations? Just one hint: UserControl won't help. You would rather need a custom control based on the Control class, whatever it is.
--SA
Shahin Khorshidnia 19-Apr-12 3:52am    
Agreed
Dharmendra-18 13-Aug-12 0:33am    
To create like auto-cad application
Sergey Alexandrovich Kryukov 13-Aug-12 13:28pm    
Knowing this still not enough.
Nevertheless, I can give you some general recommendation, as just one of possible options, my in my view -- most promising one: WPF.
--SA

1 solution

If this is a CAD like application (I hope you are not going to create another AutoCAD :-)), I would recommend to think about using WPF, which was designed with this sort of application in mind. In particular, you may think about building all you graphical design around System.Windows.Controls.Canvas:
http://msdn.microsoft.com/en-us/library/system.windows.controls.canvas.aspx[^].

You won't need to care about graphical rendering and many other detail like mouse hit test, zooming, panning and more. You can put any kinds of UI elements on the instance of Canvas, primitive (like like or rectangle) or complex. You can even put other instances on Canvas to represent compound elements. This way, you can implement hierarchical grouping and ungrouping. You can even allow the users to create their own elements and put them on Canvas.

The user can create any elements even using some 3-rd party tools. For example, I would highly recommend Inkscape:
http://en.wikipedia.org/wiki/Inkspace[^],
http://inkscape.org/[^].

Even though its graphics is based on SVG (http://inkscape.org/[^]), it can be converted to XAML, so you can easily use user's graphic elements in your WPF applications. The users should understand that SVG graphics is somewhat richer than XAML, so they should not use some advanced properties not allowed by XAML, such as blurring.

This is just one of possible approaches, but I think it would be most promising. Potentially, you can even develop it for both WPF and Silverlight and make the online tool out of it.

—SA
 
Share this answer
 
v2
Comments
Kenneth Haugland 13-Aug-12 13:50pm    
A 5. Here is one good example:
http://blog.spencen.com/2007/11/09/xaml-and-wpf--or-quotim-seeing-starsquot.aspx
Sergey Alexandrovich Kryukov 13-Aug-12 14:01pm    
Thank you, Kenneth.
Your link is interesting, but not for the CAD, where you need to operate elements programmatically, not via XAML which creates static picture, perhaps with some motion...
--SA
Kenneth Haugland 13-Aug-12 14:22pm    
I always remember the links were I learnd something new, it quite useful, as long as they dont delete their blog that is :-)
Shahin Khorshidnia 15-Aug-12 15:09pm    
+5
Sergey Alexandrovich Kryukov 15-Aug-12 15:17pm    
Thank you, Shahin.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900