![](/img/trans.png)
[英]WPF | C# - When WindowStyle = “None” and the window is maximized the Task Bar doesn't show up
[英]Hide task bar in maximized state when WindowStyle is SingleBorderWindow
我在設置窗口中放置了一個選項,供用戶選擇最大化窗口時顯示Windows任務欄還是完全進入全屏模式。
我試過了
static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
const uint SWP_NOSIZE = 0x0001;
const uint SWP_NOMOVE = 0x0002;
const uint SWP_SHOWWINDOW = 0x0040;
public static void SetFormTopMost()
{
IntPtr windowHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle;
SetWindowPos(windowHandle, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
}
但這是行不通的。 甚至沒有使它成為TopMost。
您可以嘗試以下方法:
public void MaximizeWindow(bool IsFullScreenWithTaskbar)
{
if (IsFullScreenWithTaskbar)
{
this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;
}
this.WindowStyle = WindowStyle.SingleBorderWindow;
this.ResizeMode = ResizeMode.NoResize;
this.WindowState = WindowState.Maximized;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.