显示和隐藏系统任务栏的类
1 public static class WinTask 2 { 3 private const int SW_HIDE = 0;//API参数表示隐藏窗口 4 private const int SW_SHOW = 5;//API参数表示用当前的大小和位置显示窗口 5 6 [DllImport("user32.dll")] 7 private static extern int FindWindow(string ClassName, string WindowName); 8 [DllImport("user32.dll")] 9 private static extern int ShowWindow(int handle, int cmdShow); 10 /// <summary> 11 /// 显示 12 /// </summary> 13 public static void ShowTaskBar() 14 { 15 ShowWindow(FindWindow("Shell_TrayWnd", null), SW_SHOW); 16 } 17 /// <summary> 18 /// 隐藏 19 /// </summary> 20 public static void HideTaskBar() 21 { 22 ShowWindow(FindWindow("Shell_TrayWnd", null), SW_HIDE); 23 } 24 }
这样写完后任务栏是隐藏了,但是开始按钮还在,解决方案把任务栏设为自动隐藏就可以啦