Может кто-нибудь сказать мне, как удалить кнопку закрытия (X) из окна WPF?Я могу отключить его с помощью следующего кода, но не могу удалить его:
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);
}