Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我从这个链接中找到了一篇形状绘图文章。我正在尝试添加一个检查,以使绘制的线不会超出表单区域。
感谢您在解决此问题方面的指导。
您可以使用Containsa 的方法Rectangle。尝试这个:
Contains
Rectangle
bool isLineCutOff = !(yourForm.ClientRectangle.Contains(p1) && yourForm.ClientRectangle.Contains(p2)); //p1 and p2 are 2 endpoints of your line.