隐藏最小化、最大化按钮,十分简单,设置属性ResizeMode的值为NoResize即可。
private const int GWL_STYLE = -16;
private const int WS_SYSMENU = 0x80000;
[System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
var hwnd = new System.Windows.Interop.WindowInteropHelper(this).Handle;
隐藏关闭按钮代码如下:
然后,在装载事件
Window_Loaded
中加入以下代码:
引自:http://blog.sina.com.cn/s/blog_7a19640201018wy5.html