[WPF疑难]避免窗口最大化时遮盖任务栏
周银辉
WPF窗口最大化时有个很不好的现象是:如果窗口的WindowStyle被直接或间接地设置为None后(比如很多情况下你会覆盖默认的窗体样
式,即不采用Windows默认的边框和最大化最等按钮,来打造个性的窗体),那么最大化窗口后,窗口将铺满整个屏幕而将任务栏盖住。这往往不符合实际要
求。
这里有个不错的解决方案解决了该问题,其通过对 WM_GETMINMAXINFO(MSDN: The WM_GETMINMAXINFO
message is sent to a window when the size or position of the window is
about to change. An application can use this message to override the
window's default maximized size and position, or its default minimum or
maximum tracking size.) 消息挂接一个钩子来处理。其消息代码是:0x0024(更多的消息代码可以参考本文附录)
没什么好说的,直接上代码(对你要处理的窗口调用FullScreenManager.RepairWpfWindowFullScreenBehavior方法即可):
public static class FullScreenManager
{
public static void RepairWpfWindowFullScreenBehavior(Window wpfWindow)
{
if(wpfWindow == null)
{
return;
}
if(wpfWindow.WindowState == WindowState.Maximized)
{
wpfWindow.WindowState = WindowState.Normal;
wpfWindow.Loaded += delegate { wpfWindow.WindowState = WindowState.Maximized; };
}
wpfWindow.SourceInitialized += delegate
{
IntPtr handle = (new WindowInteropHelper(wpfWindow)).Handle;
HwndSource source = HwndSource.FromHwnd(handle);
if(source != null)
{
source.AddHook(WindowProc);
}
};
}
private static IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
switch (msg)
{
case 0x0024:
WmGetMinMaxInfo(hwnd, lParam);
handled = true;
break;
}
return (IntPtr) 0;
}
private static void WmGetMinMaxInfo(IntPtr hwnd, IntPtr lParam)
{
var mmi = (MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(MINMAXINFO));
// Adjust the maximized size and position to fit the work area of the correct monitor
int MONITOR_DEFAULTTONEAREST = 0x00000002;
IntPtr monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
if (monitor != IntPtr.Zero)
{
var monitorInfo = new MONITORINFO();
GetMonitorInfo(monitor, monitorInfo);
RECT rcWorkArea = monitorInfo.rcWork;
RECT rcMonitorArea = monitorInfo.rcMonitor;
mmi.ptMaxPosition.x = Math.Abs(rcWorkArea.left - rcMonitorArea.left);
mmi.ptMaxPosition.y = Math.Abs(rcWorkArea.top - rcMonitorArea.top);
mmi.ptMaxSize.x = Math.Abs(rcWorkArea.right - rcWorkArea.left);
mmi.ptMaxSize.y = Math.Abs(rcWorkArea.bottom - rcWorkArea.top);
}
Marshal.StructureToPtr(mmi, lParam, true);
}
[DllImport("user32")]
internal static extern bool GetMonitorInfo(IntPtr hMonitor, MONITORINFO lpmi);
/// <summary>
///
/// </summary>
[DllImport("User32")]
internal static extern IntPtr MonitorFromWindow(IntPtr handle, int flags);
#region Nested type: MINMAXINFO
[StructLayout(LayoutKind.Sequential)]
internal struct MINMAXINFO
{
public POINT ptReserved;
public POINT ptMaxSize;
public POINT ptMaxPosition;
public POINT ptMinTrackSize;
public POINT ptMaxTrackSize;
} ;
#endregion
#region Nested type: MONITORINFO
/// <summary>
/// </summary>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
internal class MONITORINFO
{
/// <summary>
/// </summary>
public int cbSize = Marshal.SizeOf(typeof(MONITORINFO));
/// <summary>
/// </summary>
public RECT rcMonitor;
/// <summary>
/// </summary>
public RECT rcWork;
/// <summary>
/// </summary>
public int dwFlags;
}
#endregion
#region Nested type: POINT
/// <summary>
/// POINT aka POINTAPI
/// </summary>
[StructLayout(LayoutKind.Sequential)]
internal struct POINT
{
/// <summary>
/// x coordinate of point.
/// </summary>
public int x;
/// <summary>
/// y coordinate of point.
/// </summary>
public int y;
/// <summary>
/// Construct a point of coordinates (x,y).
/// </summary>
public POINT(int x, int y)
{
this.x = x;
this.y = y;
}
}
#endregion
#region Nested type: RECT
/// <summary> Win32 </summary>
[StructLayout(LayoutKind.Sequential, Pack = 0)]
internal struct RECT
{
/// <summary> Win32 </summary>
public int left;
/// <summary> Win32 </summary>
public int top;
/// <summary> Win32 </summary>
public int right;
/// <summary> Win32 </summary>
public int bottom;
/// <summary> Win32 </summary>
public static readonly RECT Empty;
/// <summary> Win32 </summary>
public int Width
{
get { return Math.Abs(right - left); } // Abs needed for BIDI OS
}
/// <summary> Win32 </summary>
public int Height
{
get { return bottom - top; }
}
/// <summary> Win32 </summary>
public RECT(int left, int top, int right, int bottom)
{
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
/// <summary> Win32 </summary>
public RECT(RECT rcSrc)
{
left = rcSrc.left;
top = rcSrc.top;
right = rcSrc.right;
bottom = rcSrc.bottom;
}
/// <summary> Win32 </summary>
public bool IsEmpty
{
get
{
// BUGBUG : On Bidi OS (hebrew arabic) left > right
return left >= right || top >= bottom;
}
}
/// <summary> Return a user friendly representation of this struct </summary>
public override string ToString()
{
if (this == Empty)
{
return "RECT {Empty}";
}
return "RECT { left : " + left + " / top : " + top + " / right : " + right + " / bottom : " + bottom +
" }";
}
/// <summary> Determine if 2 RECT are equal (deep compare) </summary>
public override bool Equals(object obj)
{
if (!(obj is Rect))
{
return false;
}
return (this == (RECT)obj);
}
/// <summary>Return the HashCode for this struct (not garanteed to be unique)</summary>
public override int GetHashCode()
{
return left.GetHashCode() + top.GetHashCode() + right.GetHashCode() + bottom.GetHashCode();
}
/// <summary> Determine if 2 RECT are equal (deep compare)</summary>
public static bool operator ==(RECT rect1, RECT rect2)
{
return (rect1.left == rect2.left && rect1.top ==
rect2.top && rect1.right == rect2.right &&
rect1.bottom == rect2.bottom);
}
/// <summary> Determine if 2 RECT are different(deep compare)</summary>
public static bool operator !=(RECT rect1, RECT rect2)
{
return !(rect1 == rect2);
}
}
#endregion
}
------------------------------------------
附录:
Windows Message Codes
Sorted by Name | Sorted by Code |
---|
Message | Code | Code | Message | |
---|---|---|---|---|
WM_ACTIVATE | 0x0006 | 0x0000 | WM_NULL | |
WM_ACTIVATEAPP | 0x001C | 0x0001 | WM_CREATE | |
WM_AFXFIRST | 0x0360 | 0x0002 | WM_DESTROY | |
WM_AFXLAST | 0x037F | 0x0003 | WM_MOVE | |
WM_APP | 0x8000 | 0x0005 | WM_SIZE | |
WM_APPCOMMAND | 0x0319 | 0x0006 | WM_ACTIVATE | |
WM_ASKCBFORMATNAME | 0x030C | 0x0007 | WM_SETFOCUS | |
WM_CANCELJOURNAL | 0x004B | 0x0008 | WM_KILLFOCUS | |
WM_CANCELMODE | 0x001F | 0x000A | WM_ENABLE | |
WM_CAPTURECHANGED | 0x0215 | 0x000B | WM_SETREDRAW | |
WM_CHANGECBCHAIN | 0x030D | 0x000C | WM_SETTEXT | |
WM_CHANGEUISTATE | 0x0127 | 0x000D | WM_GETTEXT | |
WM_CHAR | 0x0102 | 0x000E | WM_GETTEXTLENGTH | |
WM_CHARTOITEM | 0x002F | 0x000F | WM_PAINT | |
WM_CHILDACTIVATE | 0x0022 | 0x0010 | WM_CLOSE | |
WM_CLEAR | 0x0303 | 0x0011 | WM_QUERYENDSESSION | |
WM_CLOSE | 0x0010 | 0x0013 | WM_QUERYOPEN | |
WM_COMMAND | 0x0111 | 0x0016 | WM_ENDSESSION | |
WM_COMMNOTIFY | 0x0044 | 0x0012 | WM_QUIT | |
WM_COMPACTING | 0x0041 | 0x0014 | WM_ERASEBKGND | |
WM_COMPAREITEM | 0x0039 | 0x0015 | WM_SYSCOLORCHANGE | |
WM_CONTEXTMENU | 0x007B | 0x0018 | WM_SHOWWINDOW | |
WM_COPY | 0x0301 | 0x001A | WM_WININICHANGE | |
WM_COPYDATA | 0x004A | 0x001A | WM_SETTINGCHANGE | |
WM_CREATE | 0x0001 | 0x001B | WM_DEVMODECHANGE | |
WM_CTLCOLORBTN | 0x0135 | 0x001C | WM_ACTIVATEAPP | |
WM_CTLCOLORDLG | 0x0136 | 0x001D | WM_FONTCHANGE | |
WM_CTLCOLOREDIT | 0x0133 | 0x001E | WM_TIMECHANGE | |
WM_CTLCOLORLISTBOX | 0x0134 | 0x001F | WM_CANCELMODE | |
WM_CTLCOLORMSGBOX | 0x0132 | 0x0020 | WM_SETCURSOR | |
WM_CTLCOLORSCROLLBAR | 0x0137 | 0x0021 | WM_MOUSEACTIVATE | |
WM_CTLCOLORSTATIC | 0x0138 | 0x0022 | WM_CHILDACTIVATE | |
WM_CUT | 0x0300 | 0x0023 | WM_QUEUESYNC | |
WM_DEADCHAR | 0x0103 | 0x0024 | WM_GETMINMAXINFO | |
WM_DELETEITEM | 0x002D | 0x0026 | WM_PAINTICON | |
WM_DESTROY | 0x0002 | 0x0027 | WM_ICONERASEBKGND | |
WM_DESTROYCLIPBOARD | 0x0307 | 0x0028 | WM_NEXTDLGCTL | |
WM_DEVICECHANGE | 0x0219 | 0x002A | WM_SPOOLERSTATUS | |
WM_DEVMODECHANGE | 0x001B | 0x002B | WM_DRAWITEM | |
WM_DISPLAYCHANGE | 0x007E | 0x002C | WM_MEASUREITEM | |
WM_DRAWCLIPBOARD | 0x0308 | 0x002D | WM_DELETEITEM | |
WM_DRAWITEM | 0x002B | 0x002E | WM_VKEYTOITEM | |
WM_DROPFILES | 0x0233 | 0x002F | WM_CHARTOITEM | |
WM_ENABLE | 0x000A | 0x0030 | WM_SETFONT | |
WM_ENDSESSION | 0x0016 | 0x0031 | WM_GETFONT | |
WM_ENTERIDLE | 0x0121 | 0x0032 | WM_SETHOTKEY | |
WM_ENTERMENULOOP | 0x0211 | 0x0033 | WM_GETHOTKEY | |
WM_ENTERSIZEMOVE | 0x0231 | 0x0037 | WM_QUERYDRAGICON | |
WM_ERASEBKGND | 0x0014 | 0x0039 | WM_COMPAREITEM | |
WM_EXITMENULOOP | 0x0212 | 0x003D | WM_GETOBJECT | |
WM_EXITSIZEMOVE | 0x0232 | 0x0041 | WM_COMPACTING | |
WM_FONTCHANGE | 0x001D | 0x0044 | WM_COMMNOTIFY | |
WM_GETDLGCODE | 0x0087 | 0x0046 | WM_WINDOWPOSCHANGING | |
WM_GETFONT | 0x0031 | 0x0047 | WM_WINDOWPOSCHANGED | |
WM_GETHOTKEY | 0x0033 | 0x0048 | WM_POWER | |
WM_GETICON | 0x007F | 0x004A | WM_COPYDATA | |
WM_GETMINMAXINFO | 0x0024 | 0x004B | WM_CANCELJOURNAL | |
WM_GETOBJECT | 0x003D | 0x004E | WM_NOTIFY | |
WM_GETTEXT | 0x000D | 0x0050 | WM_INPUTLANGCHANGEREQUEST | |
WM_GETTEXTLENGTH | 0x000E | 0x0051 | WM_INPUTLANGCHANGE | |
WM_HANDHELDFIRST | 0x0358 | 0x0052 | WM_TCARD | |
WM_HANDHELDLAST | 0x035F | 0x0053 | WM_HELP | |
WM_HELP | 0x0053 | 0x0054 | WM_USERCHANGED | |
WM_HOTKEY | 0x0312 | 0x0055 | WM_NOTIFYFORMAT | |
WM_HSCROLL | 0x0114 | 0x007B | WM_CONTEXTMENU | |
WM_HSCROLLCLIPBOARD | 0x030E | 0x007C | WM_STYLECHANGING | |
WM_ICONERASEBKGND | 0x0027 | 0x007D | WM_STYLECHANGED | |
WM_IME_CHAR | 0x0286 | 0x007E | WM_DISPLAYCHANGE | |
WM_IME_COMPOSITION | 0x010F | 0x007F | WM_GETICON | |
WM_IME_COMPOSITIONFULL | 0x0284 | 0x0080 | WM_SETICON | |
WM_IME_CONTROL | 0x0283 | 0x0081 | WM_NCCREATE | |
WM_IME_ENDCOMPOSITION | 0x010E | 0x0082 | WM_NCDESTROY | |
WM_IME_KEYDOWN | 0x0290 | 0x0083 | WM_NCCALCSIZE | |
WM_IME_KEYLAST | 0x010F | 0x0084 | WM_NCHITTEST | |
WM_IME_KEYUP | 0x0291 | 0x0085 | WM_NCPAINT | |
WM_IME_NOTIFY | 0x0282 | 0x0086 | WM_NCACTIVATE | |
WM_IME_REQUEST | 0x0288 | 0x0087 | WM_GETDLGCODE | |
WM_IME_SELECT | 0x0285 | 0x0088 | WM_SYNCPAINT | |
WM_IME_SETCONTEXT | 0x0281 | 0x00A0 | WM_NCMOUSEMOVE | |
WM_IME_STARTCOMPOSITION | 0x010D | 0x00A1 | WM_NCLBUTTONDOWN | |
WM_INITDIALOG | 0x0110 | 0x00A2 | WM_NCLBUTTONUP | |
WM_INITMENU | 0x0116 | 0x00A3 | WM_NCLBUTTONDBLCLK | |
WM_INITMENUPOPUP | 0x0117 | 0x00A4 | WM_NCRBUTTONDOWN | |
WM_INPUT | 0x00FF | 0x00A5 | WM_NCRBUTTONUP | |
WM_INPUTLANGCHANGE | 0x0051 | 0x00A6 | WM_NCRBUTTONDBLCLK | |
WM_INPUTLANGCHANGEREQUEST | 0x0050 | 0x00A7 | WM_NCMBUTTONDOWN | |
WM_KEYDOWN | 0x0100 | 0x00A8 | WM_NCMBUTTONUP | |
WM_KEYFIRST | 0x0100 | 0x00A9 | WM_NCMBUTTONDBLCLK | |
WM_KEYLAST | 0x0108 | 0x00AB | WM_NCXBUTTONDOWN | |
WM_KEYLAST | 0x0109 | 0x00AC | WM_NCXBUTTONUP | |
WM_KEYUP | 0x0101 | 0x00AD | WM_NCXBUTTONDBLCLK | |
WM_KILLFOCUS | 0x0008 | 0x00FF | WM_INPUT | |
WM_LBUTTONDBLCLK | 0x0203 | 0x0100 | WM_KEYFIRST | |
WM_LBUTTONDOWN | 0x0201 | 0x0100 | WM_KEYDOWN | |
WM_LBUTTONUP | 0x0202 | 0x0101 | WM_KEYUP | |
WM_MBUTTONDBLCLK | 0x0209 | 0x0102 | WM_CHAR | |
WM_MBUTTONDOWN | 0x0207 | 0x0103 | WM_DEADCHAR | |
WM_MBUTTONUP | 0x0208 | 0x0104 | WM_SYSKEYDOWN | |
WM_MDIACTIVATE | 0x0222 | 0x0105 | WM_SYSKEYUP | |
WM_MDICASCADE | 0x0227 | 0x0106 | WM_SYSCHAR | |
WM_MDICREATE | 0x0220 | 0x0107 | WM_SYSDEADCHAR | |
WM_MDIDESTROY | 0x0221 | 0x0109 | WM_UNICHAR | |
WM_MDIGETACTIVE | 0x0229 | 0x0109 | WM_KEYLAST | |
WM_MDIICONARRANGE | 0x0228 | 0x0108 | WM_KEYLAST | |
WM_MDIMAXIMIZE | 0x0225 | 0x010D | WM_IME_STARTCOMPOSITION | |
WM_MDINEXT | 0x0224 | 0x010E | WM_IME_ENDCOMPOSITION | |
WM_MDIREFRESHMENU | 0x0234 | 0x010F | WM_IME_COMPOSITION | |
WM_MDIRESTORE | 0x0223 | 0x010F | WM_IME_KEYLAST | |
WM_MDISETMENU | 0x0230 | 0x0110 | WM_INITDIALOG | |
WM_MDITILE | 0x0226 | 0x0111 | WM_COMMAND | |
WM_MEASUREITEM | 0x002C | 0x0112 | WM_SYSCOMMAND | |
WM_MENUCHAR | 0x0120 | 0x0113 | WM_TIMER | |
WM_MENUCOMMAND | 0x0126 | 0x0114 | WM_HSCROLL | |
WM_MENUDRAG | 0x0123 | 0x0115 | WM_VSCROLL | |
WM_MENUGETOBJECT | 0x0124 | 0x0116 | WM_INITMENU | |
WM_MENURBUTTONUP | 0x0122 | 0x0117 | WM_INITMENUPOPUP | |
WM_MENUSELECT | 0x011F | 0x011F | WM_MENUSELECT | |
WM_MOUSEACTIVATE | 0x0021 | 0x0120 | WM_MENUCHAR | |
WM_MOUSEFIRST | 0x0200 | 0x0121 | WM_ENTERIDLE | |
WM_MOUSEHOVER | 0x02A1 | 0x0122 | WM_MENURBUTTONUP | |
WM_MOUSELAST(2K,XP,2k3) | 0x020D | 0x0123 | WM_MENUDRAG | |
WM_MOUSELAST(95) | 0x0209 | 0x0124 | WM_MENUGETOBJECT | |
WM_MOUSELAST(NT4,98) | 0x020A | 0x0125 | WM_UNINITMENUPOPUP | |
WM_MOUSELEAVE | 0x02A3 | 0x0126 | WM_MENUCOMMAND | |
WM_MOUSEMOVE | 0x0200 | 0x0127 | WM_CHANGEUISTATE | |
WM_MOUSEWHEEL | 0x020A | 0x0128 | WM_UPDATEUISTATE | |
WM_MOVE | 0x0003 | 0x0129 | WM_QUERYUISTATE | |
WM_MOVING | 0x0216 | 0x0132 | WM_CTLCOLORMSGBOX | |
WM_NCACTIVATE | 0x0086 | 0x0133 | WM_CTLCOLOREDIT | |
WM_NCCALCSIZE | 0x0083 | 0x0134 | WM_CTLCOLORLISTBOX | |
WM_NCCREATE | 0x0081 | 0x0135 | WM_CTLCOLORBTN | |
WM_NCDESTROY | 0x0082 | 0x0136 | WM_CTLCOLORDLG | |
WM_NCHITTEST | 0x0084 | 0x0137 | WM_CTLCOLORSCROLLBAR | |
WM_NCLBUTTONDBLCLK | 0x00A3 | 0x0138 | WM_CTLCOLORSTATIC | |
WM_NCLBUTTONDOWN | 0x00A1 | 0x0200 | WM_MOUSEFIRST | |
WM_NCLBUTTONUP | 0x00A2 | 0x0200 | WM_MOUSEMOVE | |
WM_NCMBUTTONDBLCLK | 0x00A9 | 0x0201 | WM_LBUTTONDOWN | |
WM_NCMBUTTONDOWN | 0x00A7 | 0x0202 | WM_LBUTTONUP | |
WM_NCMBUTTONUP | 0x00A8 | 0x0203 | WM_LBUTTONDBLCLK | |
WM_NCMOUSEHOVER | 0x02A0 | 0x0204 | WM_RBUTTONDOWN | |
WM_NCMOUSELEAVE | 0x02A2 | 0x0205 | WM_RBUTTONUP | |
WM_NCMOUSEMOVE | 0x00A0 | 0x0206 | WM_RBUTTONDBLCLK | |
WM_NCPAINT | 0x0085 | 0x0207 | WM_MBUTTONDOWN | |
WM_NCRBUTTONDBLCLK | 0x00A6 | 0x0208 | WM_MBUTTONUP | |
WM_NCRBUTTONDOWN | 0x00A4 | 0x0209 | WM_MBUTTONDBLCLK | |
WM_NCRBUTTONUP | 0x00A5 | 0x0209 | WM_MOUSELAST(95) | |
WM_NCXBUTTONDBLCLK | 0x00AD | 0x020A | WM_MOUSEWHEEL | |
WM_NCXBUTTONDOWN | 0x00AB | 0x020A | WM_MOUSELAST(NT4,98) | |
WM_NCXBUTTONUP | 0x00AC | 0x020B | WM_XBUTTONDOWN | |
WM_NEXTDLGCTL | 0x0028 | 0x020C | WM_XBUTTONUP | |
WM_NEXTMENU | 0x0213 | 0x020D | WM_XBUTTONDBLCLK | |
WM_NOTIFY | 0x004E | 0x020D | WM_MOUSELAST(2K,XP,2k3) | |
WM_NOTIFYFORMAT | 0x0055 | 0x0210 | WM_PARENTNOTIFY | |
WM_NULL | 0x0000 | 0x0211 | WM_ENTERMENULOOP | |
WM_PAINT | 0x000F | 0x0212 | WM_EXITMENULOOP | |
WM_PAINTCLIPBOARD | 0x0309 | 0x0213 | WM_NEXTMENU | |
WM_PAINTICON | 0x0026 | 0x0214 | WM_SIZING | |
WM_PALETTECHANGED | 0x0311 | 0x0215 | WM_CAPTURECHANGED | |
WM_PALETTEISCHANGING | 0x0310 | 0x0216 | WM_MOVING | |
WM_PARENTNOTIFY | 0x0210 | 0x0218 | WM_POWERBROADCAST | |
WM_PASTE | 0x0302 | 0x0219 | WM_DEVICECHANGE | |
WM_PENWINFIRST | 0x0380 | 0x0220 | WM_MDICREATE | |
WM_PENWINLAST | 0x038F | 0x0221 | WM_MDIDESTROY | |
WM_POWER | 0x0048 | 0x0222 | WM_MDIACTIVATE | |
WM_POWERBROADCAST | 0x0218 | 0x0223 | WM_MDIRESTORE | |
WM_PRINT | 0x0317 | 0x0224 | WM_MDINEXT | |
WM_PRINTCLIENT | 0x0318 | 0x0225 | WM_MDIMAXIMIZE | |
WM_QUERYDRAGICON | 0x0037 | 0x0226 | WM_MDITILE | |
WM_QUERYENDSESSION | 0x0011 | 0x0227 | WM_MDICASCADE | |
WM_QUERYNEWPALETTE | 0x030F | 0x0228 | WM_MDIICONARRANGE | |
WM_QUERYOPEN | 0x0013 | 0x0229 | WM_MDIGETACTIVE | |
WM_QUERYUISTATE | 0x0129 | 0x0230 | WM_MDISETMENU | |
WM_QUEUESYNC | 0x0023 | 0x0231 | WM_ENTERSIZEMOVE | |
WM_QUIT | 0x0012 | 0x0232 | WM_EXITSIZEMOVE | |
WM_RBUTTONDBLCLK | 0x0206 | 0x0233 | WM_DROPFILES | |
WM_RBUTTONDOWN | 0x0204 | 0x0234 | WM_MDIREFRESHMENU | |
WM_RBUTTONUP | 0x0205 | 0x0281 | WM_IME_SETCONTEXT | |
WM_RENDERALLFORMATS | 0x0306 | 0x0282 | WM_IME_NOTIFY | |
WM_RENDERFORMAT | 0x0305 | 0x0283 | WM_IME_CONTROL | |
WM_SETCURSOR | 0x0020 | 0x0284 | WM_IME_COMPOSITIONFULL | |
WM_SETFOCUS | 0x0007 | 0x0285 | WM_IME_SELECT | |
WM_SETFONT | 0x0030 | 0x0286 | WM_IME_CHAR | |
WM_SETHOTKEY | 0x0032 | 0x0288 | WM_IME_REQUEST | |
WM_SETICON | 0x0080 | 0x0290 | WM_IME_KEYDOWN | |
WM_SETREDRAW | 0x000B | 0x0291 | WM_IME_KEYUP | |
WM_SETTEXT | 0x000C | 0x02A1 | WM_MOUSEHOVER | |
WM_SETTINGCHANGE | 0x001A | 0x02A3 | WM_MOUSELEAVE | |
WM_SHOWWINDOW | 0x0018 | 0x02A0 | WM_NCMOUSEHOVER | |
WM_SIZE | 0x0005 | 0x02A2 | WM_NCMOUSELEAVE | |
WM_SIZECLIPBOARD | 0x030B | 0x02B1 | WM_WTSSESSION_CHANGE | |
WM_SIZING | 0x0214 | 0x02C0 | WM_TABLET_FIRST | |
WM_SPOOLERSTATUS | 0x002A | 0x02DF | WM_TABLET_LAST | |
WM_STYLECHANGED | 0x007D | 0x0300 | WM_CUT | |
WM_STYLECHANGING | 0x007C | 0x0301 | WM_COPY | |
WM_SYNCPAINT | 0x0088 | 0x0302 | WM_PASTE | |
WM_SYSCHAR | 0x0106 | 0x0303 | WM_CLEAR | |
WM_SYSCOLORCHANGE | 0x0015 | 0x0304 | WM_UNDO | |
WM_SYSCOMMAND | 0x0112 | 0x0305 | WM_RENDERFORMAT | |
WM_SYSDEADCHAR | 0x0107 | 0x0306 | WM_RENDERALLFORMATS | |
WM_SYSKEYDOWN | 0x0104 | 0x0307 | WM_DESTROYCLIPBOARD | |
WM_SYSKEYUP | 0x0105 | 0x0308 | WM_DRAWCLIPBOARD | |
WM_TABLET_FIRST | 0x02C0 | 0x0309 | WM_PAINTCLIPBOARD | |
WM_TABLET_LAST | 0x02DF | 0x030A | WM_VSCROLLCLIPBOARD | |
WM_TCARD | 0x0052 | 0x030B | WM_SIZECLIPBOARD | |
WM_THEMECHANGED | 0x031A | 0x030C | WM_ASKCBFORMATNAME | |
WM_TIMECHANGE | 0x001E | 0x030D | WM_CHANGECBCHAIN | |
WM_TIMER | 0x0113 | 0x030E | WM_HSCROLLCLIPBOARD | |
WM_UNDO | 0x0304 | 0x030F | WM_QUERYNEWPALETTE | |
WM_UNICHAR | 0x0109 | 0x0310 | WM_PALETTEISCHANGING | |
WM_UNINITMENUPOPUP | 0x0125 | 0x0311 | WM_PALETTECHANGED | |
WM_UPDATEUISTATE | 0x0128 | 0x0312 | WM_HOTKEY | |
WM_USER | 0x0400 | 0x0317 | WM_PRINT | |
WM_USERCHANGED | 0x0054 | 0x0318 | WM_PRINTCLIENT | |
WM_VKEYTOITEM | 0x002E | 0x0319 | WM_APPCOMMAND | |
WM_VSCROLL | 0x0115 | 0x031A | WM_THEMECHANGED | |
WM_VSCROLLCLIPBOARD | 0x030A | 0x0358 | WM_HANDHELDFIRST | |
WM_WINDOWPOSCHANGED | 0x0047 | 0x035F | WM_HANDHELDLAST | |
WM_WINDOWPOSCHANGING | 0x0046 | 0x0360 | WM_AFXFIRST | |
WM_WININICHANGE | 0x001A | 0x037F | WM_AFXLAST | |
WM_WTSSESSION_CHANGE | 0x02B1 | 0x0380 | WM_PENWINFIRST | |
WM_XBUTTONDBLCLK | 0x020D | 0x038F | WM_PENWINLAST | |
WM_XBUTTONDOWN | 0x020B | 0x0400 | WM_USER | |
WM_XBUTTONUP | 0x020C | 0x8000 | WM_APP |
[WPF疑难]避免窗口最大化时遮盖任务栏的更多相关文章
-
wpf 自定义窗口,最大化时覆盖任务栏解决方案
原文:wpf 自定义窗口,最大化时覆盖任务栏解决方案 相信很多人使用wpf时会选择自定义美观的窗口,因此会设置WindowStyle="None" 取消自带的标题栏.但这样使用 W ...
-
[WPF疑难] 模式窗口被隐藏后重新显示时变成了非模式窗口
原文:[WPF疑难] 模式窗口被隐藏后重新显示时变成了非模式窗口 [WPF疑难] 模式窗口被隐藏后重新显示时变成了非模式窗口 周银辉 现象: 大家可以试试下面这个很有趣但会带来Defect的现象:当我 ...
-
对话框窗口最大化盖住任务栏问题!OnGetMinMaxInfo,WM_GETMINMAXINFO
http://hi.baidu.com/csacer/item/37cd6ac2dec18d360831c6a7 在写程序时,如果包含了标题栏,但是没有包含最大化按钮或者最小话按钮,那么人工用Show ...
-
FormBorderStyle.None 时候最大化不遮盖任务栏
this.FormBorderStyle = FormBorderStyle.None; this.MaximumSize = new Size(Screen.PrimaryS ...
-
[Delphi]无边框窗口最大化不挡任务栏方法
procedure WMGetMinMaxInfo(var mes: TWMGetMinMaxInfo); message WM_GetMinMaxInfo; procedure TfrmMain.W ...
-
【转】【WPF】WPF 登录窗口关闭时打开主窗口
在WPF中设计登录窗口关闭时打开主窗口,自动生成的App.xaml不能满足要求, 1.把App.xaml的属性窗口中的生成操作设定为 无 2.添加Program类 static class Progr ...
-
wpf 自定义窗口,最大化时不覆盖任务栏
相信很多人使用wpf时会选择自定义美观的窗口,因此会设置WindowStyle="None" 取消自带的标题栏.但这样使用 WindowState="Maximized& ...
-
[WPF疑难] 继承自定义窗口
原文 [WPF疑难] 继承自定义窗口 [WPF疑难] 继承自定义窗口 周银辉 项目中有不少的弹出窗口,按照美工的设计其外边框(包括最大化,最小化,关闭等按钮)自然不同于Window自身的,但每个弹出框 ...
-
[WPF疑难]如何禁用WPF窗口的系统菜单(SystemMenu)
原文 [WPF疑难]如何禁用WPF窗口的系统菜单(SystemMenu) [WPF疑难]如何禁用WPF窗口的系统菜单(SystemMenu) 周银辉 点击窗口左上角图标时弹出来的菜单也就是这里所说的系 ...
随机推荐
-
js获取可视区域高度
document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ==> BODY对象高度 document.docume ...
-
iOS 个人账号 iOS APP Development 灰色不可选
如图,现在的开发者账号是有几个人共用的,已经 生成了一个Development 的证书,我想再申请一个,出现了这样的情况.网上有说的是申请证书个数到了上限,需要删除已经生成的.因为生成的证书其他人需要 ...
-
winform程序重启
winform程序重启的方法: private void ReStart() { string processName = System.Diagnostics.Process.GetCurrentP ...
-
JavaScript Garden2
Types Equality and Comparisons JavaScript has two different ways of comparing the values of objects ...
-
git用代码库文件完全覆盖本地/git不能提交jar的设置
用代码库中的文件完全覆盖本地工作版本. 方法如下: git reset --hard git pull 操作后 本地该目录下所有修改都会被删除!!! 谨慎操作! 项目目录下 文件:.gitignore ...
-
mybatis 直接执行sql 【我】
Connection conn = getConnection();// Connection conn = this.ss.getConnection(); 返回Connect ...
-
Harbor 搜索镜像及查看 tag
在我们搭建完 Harbor 后: https://www.cnblogs.com/klvchen/p/9482153.html 如果想要通过 API 获取 Harbor 上面的镜像及 tag 可以使用 ...
-
vue2.0 之列表渲染-v-for
v-for 数组渲染 App.vue代码 <template> <div> <ul> <li v-for="item in list"&g ...
-
大数据学习系列(7)-- hadoop集群搭建
1.配置ssh免登陆 #进入到我的home目录 cd ~/.ssh ssh-keygen -t rsa 执行完这个命令后,会生成两个文件id_rsa(私钥).id_rsa.pub(公钥) 将公钥拷贝到 ...
-
SAP事务码 一
SE80 -- edit source code. SE24 -- class create or display. SFP -- created and maintained independent ...