با تشكر از Saeed.Masoumi دوستان عزيز با msdn حلش كردم اينم كدش :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace taskb
{
public partial class Form1 : Form
{
private const int SWP_HIDEWINDOW = 0x80;
private const int SWP_SHOWWINDOW = 0x40;
[DllImport("user32.dll")]
public static extern bool SetWindowPos(
int hWnd, // handle to window
int hWndInsertAfter, // placement-order handle
short X, // horizontal position
short Y, // vertical position
short cx, // width
short cy, // height
uint uFlags // window-positioning options
);
[DllImport("user32.dll")]
public static extern int FindWindow(
string lpClassName, // class name
string lpWindowName // window name
);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
int TaskBarHwnd;
TaskBarHwnd = FindWindow("Shell_traywnd", "");
if (button1.Text == "Hide")
{
SetWindowPos(TaskBarHwnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);
button1.Text = "Show";
}
else
{
SetWindowPos(TaskBarHwnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW);
button1.Text = "Hide";
}
}
}
}