Exemple #1
0
 private void ControlsLocateForm_Load(object sender, EventArgs e)
 {
     form1.Cursor = Cursors.WaitCursor;
     resolution   = touch.GetResolution();
     if (resolution[0] != 0)
     {
         ratio = 1;
         while (resolution[0] / ratio > 200)
         {
             ratio++;
         }
         ratio--;
         pictureBox1.Width  = resolution[0] / ratio;
         pictureBox1.Height = resolution[1] / ratio;
         this.Height        = pictureBox1.Height + 50;
         this.Width         = pictureBox1.Width + groupBox1.Width + 50;
         pictureBox1.BackgroundImageLayout = ImageLayout.Stretch;
         label4.Text = "";
         RefreshScreenshot();
         SetOffset(offsetX, offsetY);
         form1.Cursor = Cursors.Default;
     }
     else
     {
         form1.Cursor = Cursors.Default;
         MessageBox.Show("未能正确连接手机!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
         return;
     }
 }
Exemple #2
0
 private void SetPointForm_Load(object sender, EventArgs e)
 {
     form1.Cursor = Cursors.WaitCursor;
     resolution   = touch.GetResolution(); //获取屏幕分辨率
     if (resolution[0] != 0)
     {
         ratio = 1;
         while (resolution[0] / ratio > 200)
         {
             ratio++;
         }
         ratio--;
         pictureBox1.Width  = resolution[0] / ratio;
         pictureBox1.Height = resolution[1] / ratio;
         this.Height        = pictureBox1.Height + 50;
         this.Width         = pictureBox1.Width + groupBox1.Width + 50;
         pictureBox1.BackgroundImageLayout = ImageLayout.Stretch;
         label3.Text = "";
         RefreshScreenshot();
         DrawSymbol();
         if (x != -1)
         {
             textBox1.Text = (x * ratio).ToString();
             textBox2.Text = (y * ratio).ToString();
         }
         form1.Cursor = Cursors.Default;
     }
     else
     {
         form1.Cursor = Cursors.Default;
         MessageBox.Show("未能正确连接手机!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
 }