如何识别PictureBox是否已输入另一个PictureBox或Label?C#

时间:2016-06-23 19:16:20

标签: c# forms winforms c#-4.0 windows-forms-designer

我用箭头键控制picturebox1,当我进入picturebox2(或label2)时,我需要知道picturebox1是否进入了picturebox2并将picturebox1直接从picturebox2中取出。 (我知道mouseEnter就知道了。)

这是我移动picturebox1的代码(如果有帮助的话):

int x = picturebox1.Location.X;
int y = covjek.Location.Y;

if (e.KeyCode == Keys.Right) x += 3;
else if (e.KeyCode == Keys.Left) x -= 3;
else if (e.KeyCode == Keys.Up) y -= 3;
else if (e.KeyCode == Keys.Down) y += 3;

谢谢!

0 个答案:

没有答案