图片框的位置 [英] Position of picture box
本文介绍了图片框的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何获得图片框的位置
我有这个代码
How do i get the position of the picture box
I have this code
private void timer1_Tick(object sender, EventArgs e)
{
if ( pictureBox1.location = Xcoord)
{
Some code
}
}
推荐答案
1)您正在尝试分配,但您需要一个布尔表达式。使用''=='',而不是''=''; 2)C#是一种区分大小写的语言;没有位置,有位置
; 3)未声明Xcoord
,或者您根本就没有显示它; 5)Xcoord
假设某些数字类型的X坐标,但Location
是带有X和Y的结构,所以比较X和Y分开; 6)比较位置确实没有意义;为什么?你定位控件,为什么检查它?如果用鼠标定位,你永远不会准确地做到这一点,所以你真的需要对某个区域进行命中测试,而不是一个点; 7)这个代码中的括号不平衡。
没有任何情况,你所写的内容可能有用。你需要重新开始。
-SA
1) You are trying to assign, but you want a Boolean expression. Use ''=='', not ''=''; 2) C# is a case-sensitive language; there is no "location", there is "Location
"; 3)Xcoord
is not declared, or you simply don''t show it; 5)Xcoord
assume X coordinate of some numeric type, butLocation
is the structure with X and Y, so compare X and Y separately; 6) comparing location does not really make sense; why? you position the control, why checking it? it if is positioned with a mouse, you never do it accurately, so you really need do the hit test for some region, not one point; 7) brackets in this "code" are not balanced.
There is no situation when what you have written can be useful. You need to start over.
—SA
这篇关于图片框的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文