search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

C# 判斷 上/下/左/右/ESC/Enter 鍵盤輸入 – jashliao部落格

 

C# 判斷 上/下/左/右/ESC/Enter 鍵盤輸入

 

private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
    String direction;
    if (e.KeyCode == Keys.Down)
        direction = “down”;
    if (e.KeyCode==Keys.Left)
        direction = “left”;
    if (e.KeyCode==Keys.Right)
        direction = “right”;
    if (e.KeyCode==Keys.Up)
        direction = “up”;
    if (Keys.Escape)
        direction = “ESC”;
    if (e.KeyCode == Keys.Enter)
        direction = “Enter”;
}



熱門推薦

本文由 jashliaoeuwordpress 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦