从WPF窗口中删除关闭(X)按钮

时间:2010-07-09 09:51:51

标签: c# .net wpf

有人能告诉我如何从WPF窗口中删除关闭(X)按钮吗?我可以通过以下代码禁用它,但无法将其删除:

    private const uint SC_CLOSE = 0xF060; 
    [DllImport("user32.dll")] 
    private static extern IntPtr GetSystemMenu(IntPtr hwnd, bool revert); 
    [DllImport("user32.dll")] 
    private static extern bool DeleteMenu(IntPtr hMenu, uint position, uint flags);

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        WindowInteropHelper helper = new WindowInteropHelper(this); 

        IntPtr hwnd = GetSystemMenu(helper.Handle, false); 

        DeleteMenu(hwnd, SC_CLOSE, 0); 

    }

0 个答案:

没有答案
相关问题