Idea:
I want to make smth like real time electronic blackboard. Many users have one board at the screen and can draw smth at the same time, and board will update.
Implementation:
I have multi user Socket server thats allow chatting (blackboard will be new feature), i need when one user drew smth the borad should update to other users(may be it should be serialized and sent or smth else).
Question:
How can i send this image? I think i need send not whole image,but only coordinate, or your suggestions?
UPDATE: I found that in .net exists InkCanvas it is what i need, but how send image from it, is question
UPDATE: Image in InkCanvas are represented as Stroke objects, and StrokeCollection class has a Save() method that serializes image. One of solutions 🙂
IMO, first you will need to use the Drawing namespace to let the user draw on perhaps a panel or something. I don’t think that would be that difficult comparing to what is next. The transferring of the information. As you have figured on HOW to transfer the data (socket), your next problem is WHAT to transfer. Sending a complete image would work but will be a wastage of network bandwidth and would be completely inefficient. So coordinates are your best choice
The two links provided mention how to use coordinates to draw something. The way to transport the information is probably XML or your own encoding mechanism to encode X1,Y1 to X2,Y2 coordinates.
Capturing coordinates when drawing straight lines (or basic shapes) should be easy but i do not have an idea of how to do it when freehand drawing is used.
And finally, you should have a mechanism in making sure everyone in the chat room get the coordinates correctly as soon as something is drawn.
UPDATE:
About your freehand drawing issue, these links will help you
http://www.codeproject.com/KB/GDI-plus/Freehand_Drawing.aspx
http://www.c-sharpcorner.com/forums/ShowMessages.aspx?ThreadID=88543
http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.graphicspath.aspx
This link looks very promising as it is a whiteboard application used by 2 users… With a little more effort, perhaps you can make it work for any amount of users 🙂
http://www.codeproject.com/KB/dotnet/csharpwhiteboard.aspx