WPF Window's style

来源:互联网 发布:显微镜图像分析软件 编辑:程序博客网 时间:2024/06/02 23:18

        private void OnLoaded(Object sender, EventArgs e)
        {
            int nStyle = Win32API.GetWindowLong(new WindowInteropHelper(this).Handle, Win32API.GWL_STYLE);

            nStyle &= ~Win32API.WS_SYSMENU;

            Win32API.SetWindowLong(new WindowInteropHelper(this).Handle, Win32API.GWL_STYLE, nStyle);
         } 

 

    public class Win32API
    {
        public const int GWL_STYLE = -16;

        public const int GWL_EXSTYLE = -20;

        public const int WS_CAPTION = 0x00C00000;
        public const int WS_SYSMENU = 0x00080000;


        [DllImport("user32.dll")]

        public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int newN);

 

        [DllImport("user32.dll")]

        public static extern int GetWindowLong(IntPtr hWnd, int nIndex);

    }

原创粉丝点击