zoukankan      html  css  js  c++  java
  • 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);
  • 相关阅读:
    BZOJ1556 墓地秘密
    [NOI2006]网络收费
    UVA11401 Triangle Counting
    UVA11538 Chess Queen
    BZOJ2560 串珠子
    BZOJ4057 [Cerc2012]Kingdoms
    [HNOI2012] 集合选数
    [Haoi2016]字符合并
    [Snoi2013]Quare
    洛谷平衡树模板总结
  • 原文地址:https://www.cnblogs.com/duguzhenglong/p/2756413.html
Copyright © 2011-2022 走看看