private const int SW_HIDE = 0; //隱藏任務欄
private const int SW_RESTORE = 9;//顯示任務欄
[DllImport("user32.dll")]
public static extern int ShowWindow(int hwnd, int nCmdShow);
[DllImport("user32.dll")]
public static extern int FindWindow(string lpClassName, string lpWindowName);
/// <summary>
/// 顯示任務欄
/// </summary>
public static void showtask()
{
ShowWindow(FindWindow("Shell_TrayWnd", null), SW_RESTORE);
}
/// <summary>
/// 隱藏任務欄
/// </summary>
public static void Hidetask()
{
ShowWindow(FindWindow("Shell_TrayWnd", null), SW_HIDE);
}