[問題] 鍵盤輸入來上下左右移動圖片
小弟嘗試寫的一個C#程式碼片段
圖片是放在PICTUREBOX裡的一個圖片 檔名為picS
不過寫完跑出來卻沒效果
能不能幫我看看是哪邊出問題呢
(對不起有斷行~"~ 我想把它顯示在同頁裡)
private void KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Up:
{
picS.Location = new System.Drawing.Point(picS.Location.X,
picS.Location.Y - 20);
break;
}
case Keys.Down:
{
picS.Location = new System.Drawing.Point(picS.Location.X,
picS.Location.Y + 20);
break;
}
case Keys.Left:
{
picS.Location = new System.Drawing.Point(picS.Location.X
- 20, picS.Location.Y);
break;
}
case Keys.Right:
{
picS.Location = new System.Drawing.Point(picS.Location.X
+ 20, picS.Location.Y);
break;
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.227.119.25
推
02/08 13:03, , 1F
02/08 13:03, 1F
推
02/08 13:10, , 2F
02/08 13:10, 2F
推
02/08 17:15, , 3F
02/08 17:15, 3F
→
02/11 16:27, , 4F
02/11 16:27, 4F