Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Experts,

I have this html5 canvas and I wish to access it from the code-behind in order to Draw on it through C# code (because the drawing program is ready made in C#). So practically I just wish to have my program use the html5 canvas instead of its wpf panel to draw onto.

I am concerned with the speed at which the drawings will appear on the canvas since one is on server side and the other would be on client side right? I don't want to have any legs or delays. Kindly guide me in the right direction.

Thanks a lot,
Justin
Posted

A html5 canvas is meant for client-side drawing. In your case you want to draw server-side and therefor don't need a html5 canvas. Have a look at the link how to dynamically create server-side images.
Create Dynamic Images in ASP.NET[^]

Good luck!
 
Share this answer
 
Comments
Jukatzu 12-Mar-12 8:49am    
I don't want to create images. This has to remain as editable as possible. And due to the extensive amount of data that has to be drawn I don't want to re-draw the whole image everytime. Ideally I keep the features of the canvas :s
E.F. Nijboer 12-Mar-12 10:49am    
A html5 canvas results to an image. You draw on its canvas, but that is actually the same as you would using c#. It is simply impossible to draw on a html5 canvas directly from server-side c#. However, if you want to re-use your c# you might want to consider using silverlight instead of html5.
Sergey Alexandrovich Kryukov 12-Mar-12 11:48am    
Good point, voted 5.
--SA
Jukatzu 12-Mar-12 13:17pm    
but silverlight limits me to the device's capabilities...html5 canvas runs on all major browsers even tablets'. any more good suggestions? I need a very efficient medium since this is gonna be a collaborative whiteboard application.

Thanks a lot E.F. Nijiboer. Your comments are much appreciated.
E.F. Nijboer 13-Mar-12 4:31am    
In that case you would really need to translate the functionality from c# to javascript in order to make it work on the client. Client and server are two separate environments that cannot control components directly. Silverlight and Flash are components that implement this kind of functionality. I think translating your c# to javascript shouldn't be to hard because you already have it working and know how to implement. You need to remember that c# needs a .net framework on the machine it is running on (which can provided by silverlight for your browser) and therefor can't run natively in your browser.
I ran into the same issue, wanting to start with a drawing, but leave it editable for the user. Please see my answer to this in my open source suite of HTML5 controls. If it's not quite what you're looking for, please let me know what other features would make the canvas complete.
 
Share this answer
 

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