WPF full screen on maximize

后端 未结 9 1888
醉话见心
醉话见心 2021-02-04 12:56

I basically want to have my WPF window to go in full screen mode, when F11 is pressed or the maximize button in the right top corner of the window is pressed.

While the

9条回答
  •  悲哀的现实
    2021-02-04 13:27

    You can hide the taskbar if you import user32.dll...

    [DllImport("user32.dll")]
    private static extern int FindWindow(string className, string windowText);
    [DllImport("user32.dll")]
    private static extern int ShowWindow(int hwnd, int command);
    
    private const int SW_HIDE = 0;
    private const int SW_SHOW = 1;
    

    Usage:

    int hwnd = FindWindow("Shell_TrayWnd","");
    ShowWindow(hwnd,SW_HIDE);
    

提交回复
热议问题