Click here to Skip to main content
15,889,034 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is a demo project drawboard. I would like to make it so that all clients connected to one server see whatever I draw on that board. I have created a class called MyMouseEventArgs class.
I do not know how to proceed after that.

I have posted my code below:
C#
if (isdrawing)
           {
               using (Graphics gr=this.CreateGraphics())
               {
                   gr.DrawLine(p, prev, e.Location);
                   cv.Coordinates.Add(prev);
                   prev = e.Location;
               }
           }
           p.Dispose();
       }


This is the function I am using to draw on the form.

This is my serialized class which I am going to pass.
C#
[Serializable]
    class MyMouseEventArgs : EventArgs
    {
        public MyMouseEventArgs(MouseButtons button, int clicks, int x, int y, int delta)
        {
            _Button = button;
            _Clicks = clicks;
            _X = x;
            _Y = y;
            _Delta = delta;
        }

        private MouseButtons _Button;
        private int _Clicks;
        private int _Delta;
        private int _X;
        private int _Y;

        public MouseButtons Button { get { return _Button; } }
        public int Clicks { get { return _Clicks; } }
        public int Delta { get { return _Delta; } }
        public Point Location { get { return new Point(_X, _Y); } }
        public int X { get { return _X; } }
        public int Y { get { return _Y; } }

        public static implicit operator MyMouseEventArgs(MouseEventArgs e)
        {
            return new MyMouseEventArgs(e.Button, e.Clicks, e.X, e.Y, e.Delta);
        }
        public static implicit operator MouseEventArgs(MyMouseEventArgs e)
        {
            return new MouseEventArgs(e.Button, e.Clicks, e.X, e.Y, e.Delta);
        }
    }

Whenever the draw event occurs it has to draw on the client screens too.
I have little knowledge about the concept serialization.

If you help me I promise that I will give you the code for unlimited file transfer over LAN network (c#).
Posted
Updated 13-Nov-11 4:07am
v5
Comments
Richard MacCutchan 13-Nov-11 7:40am    
Sorry but nobody is going to download your source; show the piece that does not work, explain what the problem is, and people will try to help you.
mohanrajkiller 13-Nov-11 8:11am    
i have given the code
Mehdi Gholam 13-Nov-11 8:04am    
EDIT -> moved update from OP's solution post
mohanrajkiller 13-Nov-11 8:09am    
sorry i am new to this forum :( what can i do to show on my client screen

1 solution

Here[^] are some links to help with serialisation; you may wish to use XML or implement your own structure to transport the information. I am assuming that you already have the client/server part working.
 
Share this answer
 
Comments
mohanrajkiller 13-Nov-11 9:01am    
i have hardly a day time as i am totally confused
i need sytax for example if e is the object of my class how can i send them toward client and the code for deserialization :( i promise i will give you the code for unlimited data tranfe c# code project made by my friend
Richard MacCutchan 13-Nov-11 9:42am    
Why would I want some code from your friend in return for giving you the code for this problem?

If you don't have time to do this then I suggest you move on and find something that you can achieve. I'm afraid this site is here to help people who help themselves, not to do their work for them.
mohanrajkiller 13-Nov-11 10:18am    
i am sorry i have learned from you !
i feel guilty :(
mohanrajkiller 13-Nov-11 10:40am    
i have read that xml serialization how to send that as bytestream through network
Richard MacCutchan 13-Nov-11 10:56am    
Lots of ways, take a look at this.

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