midora Posted August 30, 2013 Share Posted August 30, 2013 None of the following issues is in any way important. Just a list I collected for a while. 1) Shortcuts in menus There is a small issue with OEM character shortcuts. I.E Ctrl++ does not work with a german keyboard layout. The reason is that '+' is Shift+1. Here a code snippet how I solved this in other applications tsmi.ShortcutKeys = OemCharacterToKeys(Keys.Control, '+'); tsmi.ShortcutKeyDisplayString = OemCharacterToDisplayString(Keys.Control, '+'); [DllImport("user32.dll", CharSet = CharSet.Unicode)] private static extern short VkKeyScanW(char ch); private static Keys CharactertoKeys(char c) { // Map character to scan code short scanCode = VkKeyScanW(c); // Translate scan code to key Keys key = (Keys)(scanCode & 0x00FF); if ((scanCode & 0x0100) != 0) key |= Keys.Shift; if ((scanCode & 0x0200) != 0) key |= Keys.Control; if ((scanCode & 0x0400) != 0) key |= Keys.Alt; return key; } public static Keys OemCharacterToKeys(Keys modifiers, char c) { return modifiers | CharactertoKeys(c); } public static string OemCharacterToDisplayString(Keys modifiers, char c) { // Get the text for the combination of the modifiers with the A key string text = new KeysConverter().ConvertToString(modifiers | Keys.A); // Replace the dummy A key with the character return text.Remove(text.Length - 1) + c; } And please do not translate the ShortcutKeyDisplayString. The result is that some few shortcuts are translated and the most other ones are not. I.e. Ctrl++ shows STRG++ while Ctrl+B shows Ctrl-B. 2) Zooming with the wheel does not look to be deterministic ;-) Here is a proposal scaleFactor = ScaleByIncrement(scaleFactor, (int)Math.Round(wheelDeltaNormalized)); private float ScaleByIncrement(float scaleFactor, int increment) { const double steps = 8; // number of steps between 2^n and 2^(n+1) double n = Math.Log(scaleFactor, 2); // scaleFactor=2^n => determine n n = Math.Round(n * steps) / steps; // round n depending on steps n += (double)increment / steps; // add the increment scaleFactor = (float)Math.Pow(2, n); // calculate the scale factor // This generates the following scaleFactor values (steps=8) // ..., 0.125, ..., 0.25, ..., 0.5, 0.545, 0.595, 0.648, 0.707, 0.771, 0.841, 0.917, 1 // 1, 1.091, 1.189, 1.297, 1.414, 1.542, 1.682, 1.834, 2, ..., 4, ..., 8, ... return scaleFactor; } 3) Ticks in ruler. OK this is a bit pedantic ;-) If the main division is 50 then the next subdivision is 20 40 70 90 better would be 20 40 60 80. This seems always be the case if the subdivision is 1/2.5 (and not 1/2). It took a while figuring out why the rulers are looking strange to me. But maybe this is a US thing... 4) Allow escape key to reset the pan function (this is what Windows allows while moving a window). 5) Show the drag image while dragging on top of Paint.NET and not just the drag cursor. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.