我猜你说的时钟和控制面板是指任务栏?
如果是,我们使用以下帮助程序隐藏/显示整个栏。不过,这是一个相当“困难”的方法,因为它会为系统而不仅仅是你的应用程序隐藏它,所以你需要在应用程序关闭时再次显示它:
private const int SW_HIDE = 0x0000;
private const int SW_SHOW = 0x0005;
[DllImport("coredll.dll", EntryPoint = "FindWindowW", SetLastError = true)]
private static extern IntPtr FindWindowW(string lpClassName, string lpWindowName);
[DllImport("coredll.dll")]
private static extern int ShowWindow(IntPtr hwnd, int nTaskShow);
public static void HideStartBar()
{
IntPtr handle = FindWindowW("HHTaskBar", string.Empty);
if (handle != IntPtr.Zero)
ShowWindow(handle, SW_HIDE);
}
public static void ShowStartBar()
{
IntPtr handle = FindWindowW("HHTaskBar", string.Empty);
if (handle != IntPtr.Zero)
ShowWindow(handle, SW_SHOW);
}