实现效果:

知识运用:
API函数FindWindowEx //在窗口列表中寻找与指定条件相符的第一个子窗口

实现代码:
private const int SW_HIDE = 0;
private const int SW_SHOW = 5;
[DllImport("user32.dll")] //寻找窗口列表中第一个符合指定条件的顶级窗口
public static extern int FindWindow(string IpClassName, string IpWindowName);
[DllImport("user32.dll")] //控制窗口的可见性
public static extern int ShowWindow(int hwnd, int nCmdShow);
[DllImport("user32.dll")] //在窗口列表中寻找与指定条件相符的第一个子窗口
public static extern int FindWindowEx(int hWnd1,int hWnd2,string Ipsz1,string Ipsz2);
private void button1_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
ShowWindow(FindWindowEx(FindWindow("Shell_TrayWnd", null), 0, "Start", null), SW_HIDE); //隐藏开始按钮
else
ShowWindow(FindWindowEx(FindWindow("Shell_TrayWnd", null), 0, "Start", null), SW_SHOW);//显示开始按钮
}
浙公网安备 33010602011771号