-1

标签 1:

lblLeftToRight.Location = new Point(lblLeftToRight.Location.X + 10, lblLeftToRight.Location.Y);

标签 2:

lblLeftToRight.Location = new Point(lblLeftToRight.Location.X - 10, lblLeftToRight.Location.Y);

通过使用timerPoint结构,我正在移动 label1 和 label2。我想在两个标签相互联系时发出一条消息。

4

1 回答 1

1

它应该很简单:http: //msdn.microsoft.com/en-us/library/y10fyck0.aspx

标签有:顶部、左侧、高度和宽度

Rectangle r1 = new rectangle (label1.left,label1.top,label1.width,label1.height);
Rectangle r2 = new rectangle (label2.left,label2.top,label2.width,label2.height);

if  (r1.IntersectsWith(r2))
{
// do stuff
}
于 2012-09-25T07:34:03.500 回答