Click here to Skip to main content
13,002,169 members (75,197 online)
Rate this:
Please Sign up or sign in to vote.
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:
if (isdrawing)
               using (Graphics gr=this.CreateGraphics())
                   gr.DrawLine(p, prev, e.Location);
                   prev = e.Location;

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

This is my serialized class which I am going to pass.
    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 13-Nov-11 1:27am
Updated 13-Nov-11 4:07am
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

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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.
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.
mohanrajkiller 13-Nov-11 11:27am
but in that page after xml serialization it is stored in computer how to transfer . thank you for guiding ::)
Richard MacCutchan 13-Nov-11 12:27pm
Have you ever heard of sockets?
mohanrajkiller 14-Nov-11 1:04am
yes it took some time to read in detail will i be able to connect upto 50 clients using that
Richard MacCutchan 14-Nov-11 4:25am
In theory you can connect an unlimited number, it all depends on the speed of your hardware and the efficiency of your software.
mohanrajkiller 14-Nov-11 7:43am
ok how can i differentiate server and client in socket!
Richard MacCutchan 14-Nov-11 12:04pm
The server is at the other end! Come on, read the documentation and try and learn for yourself.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170624.1 | Last Updated 13 Nov 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100