C#控件的persfic位置......... [英] C# persfic location of a control............

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

问题描述

这是我的代码

this is my code

if (tineline.Location.X == newlabel.Location.X || tineline.Location.Y == newlabel.Location.Y)
           {
               MessageBox.Show("HI");
           }



正在尝试制作它,使其在遇到诸如
之类的位置时会执行某些操作



im tring to make it so it will do something when it hits a perfic location like

>if (form1.panel2.tineline.X == form1.panel2.newlabel.Location.X)
{
 MessageBox.Show("We There Yet?");
}


推荐答案

替换OR条件"||" AND条件为&&"的情况:
如果两个条件中的任何一个为真,则OR为真;而只有两个条件为真,则AND为真:
Replace the OR condition "||" with an AND condition "&&":
OR is true if either of the conditions is true, AND is true only of both of them are true:
if (tineline.Location.X == newlabel.Location.X && tineline.Location.Y == newlabel.Location.Y)
           {
               MessageBox.Show("HI");
           }

相当于写作:

It is the equivalent of writing:

if (tineline.Location.X == newlabel.Location.X)
   {
   if (tineline.Location.Y == newlabel.Location.Y)
      {
      MessageBox.Show("HI");
      }
   }


这篇关于C#控件的persfic位置.........的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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