【发布时间】:2014-04-13 13:23:42
【问题描述】:
我在 C# 中移动按钮时遇到问题。我想了很多次。而且我还没有弄清楚我的代码有什么问题。如果你们能找出我的错误在哪里,请帮助我。之前非常感谢你。
这是我应该在按下箭头键时移动按钮的方法。
private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyValue == 39)
{
button1.Location = new Point(button1.Location.X + 1, button1.Location.Y);
}
else if (e.KeyValue == 37)
{
button1.Location = new Point(button1.Location.X - 1, button1.Location.Y);
}
}
【问题讨论】:
-
在没有问题描述的情况下很难提供解决方案。你说你有问题,但不是问题到底是什么。