public Form1() { InitializeComponent(); LoadSettings(); label3.Text = Server.port + ""; Server.StartServer(); Server.ImageCaptured += img1; MessageProcessor.Start(); KeyPreview = true; KeyUp += Form1_KeyUp; pictureBox1.MouseWheel += PictureBox1_MouseWheel; pictureBox1.SizeChanged += PictureBox1_SizeChanged; bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height); gr = Graphics.FromImage(bmp); pictureBox1.Image = bmp; }
private void timer2_Tick(object sender, EventArgs e) { if (CurrentClient != null) { try { var pos = pictureBox1.PointToClient(Cursor.Position); if (pictureBox1.ClientRectangle.IntersectsWith(new Rectangle(pos.X, pos.Y, 1, 1))) { pos = GetScaledCursor(); if (lastPoint.X != pos.X || lastPoint.Y != pos.Y) { lastPoint = pos; MessageProcessor.AddMessage(new MouseMoveMessage(pos)); } } } catch (Exception ex) { CurrentClient = null; MessageBox.Show("client lost"); } } }
public void AddMessage(Message m) { MessageProcessor.AddMessage(m); }