private void RegisterHotKeys() { this.m_capfullscreen_hotkey = new ScreenCaptureLib.HotKey(this.Handle, Keys.PrintScreen, 0); this.m_capactivewindow_hotkey = new ScreenCaptureLib.HotKey(this.Handle, Keys.PrintScreen, ScreenCaptureLib.HotKeyModifierKey.LEFTALT); this.m_caplast_hotkey = new ScreenCaptureLib.HotKey(this.Handle, Keys.PrintScreen, ScreenCaptureLib.HotKeyModifierKey.CONTROL); set_key_text(this.m_capfullscreen_hotkey, this.labelCapFullScreenInstruction, "Capture screen"); set_key_text(this.m_capactivewindow_hotkey, this.labelCapActiveWindowInstruction, "Capture active window"); set_key_text(this.m_caplast_hotkey, this.labelCapLast, "Repeat last capture"); }
private void set_key_text(ScreenCaptureLib.HotKey hotkey, Label label, string text) { if (hotkey.IsRegistered) { string msg = string.Format("{0} -> {1}", hotkey.DisplayName, text); label.Text = msg; } else { string msg = string.Format("Could not register {0} hotkey", hotkey.DisplayName); label.Text = msg; } }