From 52f25dfe9637ef235eb6e6f62e24814315176cd6 Mon Sep 17 00:00:00 2001 From: pubpub-zz <4083478+pubpub-zz@users.noreply.github.com> Date: Mon, 8 Mar 2021 23:42:37 +0100 Subject: [PATCH] Enh : shift/CapsLock + MouseWheel to rotate between pens rotate between pens with shift pressed of with caps lock toggled on issue #59 --- src/FormCollection.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/FormCollection.cs b/src/FormCollection.cs index d6e00d2..c651709 100644 --- a/src/FormCollection.cs +++ b/src/FormCollection.cs @@ -960,6 +960,24 @@ private void IC_MouseWheel(object sender, CancelMouseEventArgs e) ZoomForm.Width += t*10; return; } + if (((GetKeyState(VK_LSHIFT ) | GetKeyState(VK_RSHIFT)) & 0x8000)!= 0 || System.Windows.Input.Keyboard.IsKeyToggled(System.Windows.Input.Key.CapsLock)) + { + int p = LastPenSelected + (e.Delta>0?1:-1); + if (p >= Root.MaxPenCount) + p = 0; + if (p < 0) + p = Root.MaxPenCount - 1; + while (!Root.PenEnabled[p]) + { + p += (e.Delta > 0 ? 1 : -1); + if (p >= Root.MaxPenCount) + p = 0; + if (p < 0) + p = Root.MaxPenCount - 1; + } + SelectPen(p); + return; + } Root.GlobalPenWidth += Root.PixelToHiMetric(e.Delta > 0 ? 2 : -2); if (Root.GlobalPenWidth < 1) Root.GlobalPenWidth = 1;