WPF自定义窗口最大化后遮挡任务栏的解决方法
I’d try something like this before going down the P/Invoke route - there is no WM_SETMINMAXINFO message that I’m aware of, so you’d probably need to override your WinProc to handle the WM_GETMINMAXINFO and return bogus data…but anyways, try this first, see if it works for you:
public class ConstrainedWindow : Window
{
public ConstrainedWindow()
{
this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;
this.MaxWidth = SystemParameters.MaximizedPrimaryScreenWidth;
}
}
窗体初始化时限定最大化大小即可
或则直接在xaml文件定义MaxHeight和MaxWidth(也可通过属性设置界面应用资源):
<Window x:Class="GUI