Click here to Skip to main content
15,740,826 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Can anybody help me ?

How to draw curve line or arrow on webform in Asp.net ?

Thanks.
Posted
Comments
Sergey Alexandrovich Kryukov 1-Nov-12 2:24am    
How a Webform is related to graphics? I'll tell you -- not related at all. Ever heard of separation of concerns?
--SA
mailanup1414 1-Nov-12 2:29am    
no. i want to display curved line dynamically on webform from coordinates (x1,y1) to (x2,y2).
Sergey Alexandrovich Kryukov 1-Nov-12 2:36am    
I tell you, it has nothing to do with WebForms. Form is not a rendered element; it is only needed to post data to server side from the client. I just answered on how to generate graphics, it should be completely clear now.
--SA

1 solution

There can be different approaches. You can generate Canvas drawing on the fly, using this HTML5 feature:
http://www.w3schools.com/html/html5_canvas.asp[^].

The problem with that is not all Web browsers support HTML5 to the required degree. To check up, please see:
http://en.wikipedia.org/wiki/HTML5[^],
http://en.wikipedia.org/wiki/Comparison_of_layout_engines_%28HTML5%29[^].

Alternatively, you can draw everything on the server side, using System.Drawing.Bitmap:
http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.image.aspx[^].

To draw on the bitmap, you should use the instance of the System.Drawing.Graphics obtained from the instance of Bitmap or an instance of any other type of System.Drawing.Image:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.aspx[^].

Then you can write a bitmap file on the server side and deliver it to the client through the <img> element with the value of src attribute containing the URI of your image. Alternatively, you can generate the whole HTTP response with appropriate content type to show just the graphics directly, without creating any files.

—SA
 
Share this answer
 
Comments
mailanup1414 1-Nov-12 2:43am    
thanks for the help. i will check
Sergey Alexandrovich Kryukov 1-Nov-12 2:59am    
You are very welcome.
Good luck, call again.
--SA
mailanup1414 1-Nov-12 3:12am    
sure :)

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