Example #1
0
        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;
        }
Example #2
0
 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");
         }
     }
 }
Example #3
0
 public void AddMessage(Message m)
 {
     MessageProcessor.AddMessage(m);
 }