wpf窗体属性
WPF中隐藏窗口最小化、最大化和关闭按钮
隐藏最小化、最大化按钮,十分简单,设置属性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);
然后,在装载事件Window_Loaded中加入以下代码:
var hwnd = new System.Windows.Interop.WindowInteropHelper(this).Handle;
SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
代做毕业设计和论文 私活, 需要.net,asp.net ,mvc ef cs 客户端,bs 网站项目开发的请私信我,