Form隐藏和显示任务栏


  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Runtime.InteropServices;
  10. namespace TaskBar
  11. {
  12.     public partial class Form1 : Form
  13.     {
  14.         [DllImport("user32.dll")]
  15.         public static extern int ShowWindow(int hwnd, int nCmdShow);
  16.          [DllImport("user32.dll")]
  17.         public static extern int FindWindow(string lpClassName,string lpWindowName);
  18.         //隐藏任务栏
  19.         private const int SW_HIDE = 0;
  20.         //显示任务栏
  21.         private const int SW_RESTORE = 9;
  22.         public Form1()
  23.         {
  24.             InitializeComponent();
  25.         }
  26.         private void show_Click(object sender, EventArgs e)
  27.         {
  28.             ShowWindow(FindWindow("Shell_TrayWnd", null), SW_RESTORE);
  29.         }
  30.         private void hide_Click(object sender, EventArgs e)
  31.         {
  32.             ShowWindow(FindWindow("Shell_TrayWnd", null), SW_HIDE);
  33.         }
  34.     }
  35. }



Form隐藏和显示任务栏

Form隐藏和显示任务栏

 

参考文献:

http://www.jb51.net/article/38151.htm

上一篇:最近在做一些文本数据显示的任务


下一篇:阿里云与神州云计算定制混合云解决方案助企业转型