【问题标题】:How can I make an "area selector" in C#?如何在 C# 中制作“区域选择器”?
【发布时间】:2012-03-17 13:29:27
【问题描述】:

this一模一样,但是没有形式上的限制,我需要能够得到矩形坐标。

感谢每一点帮助!

【问题讨论】:

  • 可能是this 之类的?

标签: c# select desktop capture area


【解决方案1】:

我希望您能够按照链接中给出的代码绘制矩形。 Draw Rectangle

现在,您想要获取坐标 X、Y、左、右。 在 Form1_Move 中添加以下新行。

 private void Form1_MouseMove(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
       Rect = new Rectangle(Rect.Left, Rect.Top, e.X - Rect.Left, e.Y - Rect.Top);
                label3.Text = Rect.Left.ToString();
                label4.Text = Rect.Top.ToString();
                label1.Text = e.X.ToString();
                label2.Text = e.Y.ToString();
     }
            this.Invalidate();
 }

【讨论】:

  • 我需要能够在表单外创建一个矩形。
  • 你想达到什么目的?你想对“屏幕”的一部分进行“选择”还是什么?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-09-04
  • 2021-03-09
相关资源
最近更新 更多