To reproduce my problem please do the following:
FormBorderStyle
to None
.In the default FormBorderStyle
setting the MaximizeBox
property to false will disable the Windows+Up fullscreen shortcut.
If the FormBorderStyle
is set to None
Microsoft decided it would be a good idea to disable all the Windows+Arrow key shortcuts except for the up arrow and then disable the disabling of the MaximizeBox
property.
Is this a glitch? Any simple way to disable this shortcut function the selfsame way it is disabled on all the other FormBorderStyles?
The most common way to get out of full screen mode on Windows 10 is to use the 11th function key. To leave full screen mode on Windows 10, press F11 located near the top-right of your keyboard. You can press F11 again to return.
The usual way to get into and out of full screen mode is by using the F11 key. If this does not work for you, try to hit Alt + Space to open the application menu and click (or use the keyboard) to choose Restore or Minimize. Another way is to hit Ctrl + Shift + Esc to open the Task Manager.
Windows does this by calling SetWindowPos() to change the position and size of the window. A window can be notified about this by listening for the WM_WINDOWPOSCHANGING message and override the settings. Lots of things you can do, like still giving the operation a meaning by adjusting the size and position to your liking. You completely prevent it by turning on the NOSIZE and NOMOVE flags.
Paste this code into your form:
private bool AllowWindowChange;
private struct WINDOWPOS {
public IntPtr hwnd, hwndInsertAfter;
public int x, y, cx, cy;
public int flags;
}
protected override void WndProc(ref Message m) {
// Trap WM_WINDOWPOSCHANGING
if (m.Msg == 0x46 && !AllowWindowChange) {
var wpos = (WINDOWPOS)System.Runtime.InteropServices.Marshal.PtrToStructure(m.LParam, typeof(WINDOWPOS));
wpos.flags |= 0x03; // Turn on SWP_NOSIZE | SWP_NOMOVE
System.Runtime.InteropServices.Marshal.StructureToPtr(wpos, m.LParam, false);
}
base.WndProc(ref m);
}
When you want to change the window yourself, simply set the AllowWindowChange field temporarily to true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With