protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Program.IsMono) { //Mono does not trigger the activate/deactivate events when opening a modal popup, but it does set the form to disabled //Use this to reset key states this.EnabledChanged += (object s, EventArgs evt) => { InputApi.ResetKeyState(); }; } }
public frmGetKey(bool singleKeyMode) { InitializeComponent(); _singleKeyMode = singleKeyMode; if (_singleKeyMode) { tableLayoutPanel1.RowStyles[1].SizeType = SizeType.Absolute; tableLayoutPanel1.RowStyles[1].Height = 0; } if (_singleKeyMode) { lblCurrentKeys.Height = 1; lblCurrentKeys.Visible = false; } ShortcutKey = new KeyCombination(); InputApi.UpdateInputDevices(); InputApi.ResetKeyState(); //Prevent other keybindings from interfering/activating InputApi.DisableAllKeys(true); }
protected override void OnActivated(EventArgs e) { base.OnActivated(e); InputApi.ResetKeyState(); }