C#知道角落 [英] C# Knowing the corners

查看:70
本文介绍了C#知道角落的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使其知道表单每个角的位置?

How do i make it know the location of each corner of my form?

推荐答案

这些由TopBottomLeft定义,Right.对于内角,请使用ClientRectangle的相同属性,但请记住,它是int的不同坐标—相对于窗体的Location.

—SA
These are defined by Top, Bottom, Left, Right. For inner corners, use the same properties of the ClientRectangle, but remember it''s int the different coordinates — relative to form''s Location.

—SA


我以此方式尝试过:

I tried in this way:

Point LocXY = this.Location;

MessageBox.Show("Top left corner location: " + LocXY.X + "," + LocXY.Y);
MessageBox.Show("Bottom Right corner location: " + (LocXY.X + this.Width) + "," + (LocXY.Y + this.Height));
MessageBox.Show("Bottom left corner location: " + LocXY.X + "," + (LocXY.Y + this.Height));
MessageBox.Show("Top right corner location: " + (LocXY.X + this.Width) + "," + LocXY.Y);



这些消息框很烦人,但您可以按自己喜欢的方式使用结果.

希望对您有所帮助.



These message boxes are annoying but you can use the result in the way you like.

Hope it helped.


您可以使用表单的Location属性来获取一个包含表单屏幕坐标的Point.

希望对您有帮助
You can use the Location property of your form to get a Point containing the screen coordinates of the form.

Hope this helps


这篇关于C#知道角落的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆