将白板实现为桌面应用程序,无法进行序列化. [英] Implementing whiteboard as desktop application stucked in serialization.

查看:54
本文介绍了将白板实现为桌面应用程序,无法进行序列化.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个演示项目画板.我希望这样做,以便所有连接到一台服务器的客户端都能看到我在那块板上画的任何东西.我创建了一个名为MyMouseEventArgs的类.
在那之后我不知道该怎么办.

我已经在下面发布了我的代码:

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);
                   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.

[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);
        }
    }


每当发生draw事件时,它也必须在客户端屏幕上进行绘制.
我对概念序列化一无所知.

如果您有帮助,我保证会为您提供通过LAN网络(c#)进行无限制文件传输的代码.


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#).

推荐答案

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.


这篇关于将白板实现为桌面应用程序,无法进行序列化.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆