Detect shift key on application startup in C#/Windows Forms
问题 Is there a way to get a standard Windows Forms application to detect if the Shift key is being held down on application startup - without using Windows hooks? I ideally would like the workflow to change from normal if the shift key is held down when the EXE file is run. 回答1: Here is an article about reading the key states (and mouse) directly. 回答2: The ModifierKeys property looks ideal: private void Form1_Load(object sender, EventArgs e) { if ( (ModifierKeys & Keys.Shift) != 0) { MessageBox