From fcd993ce27f6883a354031d0fb52b1bee37db297 Mon Sep 17 00:00:00 2001 From: RKrom Date: Fri, 8 Jun 2012 13:57:57 +0000 Subject: [PATCH] Allowed the picker to be closed by keyboard, e.g. ESC / Alt+F4 (F10?) git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1914 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- Greenshot/Destinations/PickerDestination.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Greenshot/Destinations/PickerDestination.cs b/Greenshot/Destinations/PickerDestination.cs index c125a7985..ede54a4ec 100644 --- a/Greenshot/Destinations/PickerDestination.cs +++ b/Greenshot/Destinations/PickerDestination.cs @@ -62,9 +62,15 @@ namespace Greenshot.Destinations { ContextMenuStrip menu = new ContextMenuStrip(); menu.Closing += delegate(object source, ToolStripDropDownClosingEventArgs eventArgs) { LOG.DebugFormat("Close reason: {0}", eventArgs.CloseReason); - if (eventArgs.CloseReason != ToolStripDropDownCloseReason.ItemClicked && eventArgs.CloseReason != ToolStripDropDownCloseReason.CloseCalled) { - eventArgs.Cancel = true; - } + switch (eventArgs.CloseReason) { + case ToolStripDropDownCloseReason.ItemClicked: + case ToolStripDropDownCloseReason.CloseCalled: + case ToolStripDropDownCloseReason.Keyboard: + break; + default: + eventArgs.Cancel = true; + break; + } }; foreach (IDestination destination in destinations) { // Fix foreach loop variable for the delegate