public partial class Form1 : Form { [System.Runtime.InteropServices.DllImport("user32.dll")] private static extern short GetAsyncKeyState(Keys vKey); public Form1() { InitializeComponent(); } private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.ShiftKey) { if (Convert.ToBoolean(GetAsyncKeyState(Keys.LShiftKey))) MessageBox.Show("Left"); if (Convert.ToBoolean(GetAsyncKeyState(Keys.RShiftKey))) MessageBox.Show("Right"); } } }
C#如何在keydown事件里判断按下的是左shift还是右shift
猜你喜欢
转载自www.cnblogs.com/claricre/p/8971177.html
今日推荐
周排行