public class Win32
{
[DllImport("aygshell.dll")]
public static extern bool SHFullScreen(IntPtr hWnd, uint dwState);
//http://msdn.microsoft.com/en-us/library/aa930139.aspx
const uint SHFS_SHOWTASKBAR = 0x1;//任务栏
const uint SHFS_HIDETASKBAR = 0x2;
const uint SHFS_SHOWSIPBUTTON = 0x4;//输入法
const uint SHFS_HIDESIPBUTTON = 0x8;
const uint SHFS_SHOWSTARTICON = 0x10;//开始菜单栏
const uint SHFS_HIDESTARTICON = 0x20;
/// <summary>
/// 全屏显示,即隐藏WM和win CE的任务栏(和开始菜单栏)
/// </summary>
/// <param name="hWnd">要显示的窗体句柄</param>
/// <param name="isFull">true全屏,false取消全屏</param>
/// <returns></returns>
public static bool FullScreen(IntPtr hWnd, bool isFull)
{
uint dwState = 0;
if (isFull)
{
dwState = SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON | SHFS_HIDESTARTICON;
}
else
{
dwState = SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON | SHFS_SHOWSTARTICON;
}
return Win32.SHFullScreen(hWnd, dwState);
}
}
form的构造函数或form_load中调用:
this.WindowState = FormWindowState.Maximized;//这句不能少,且注意窗体的大小与屏幕相同
Win32.FullScreen(this.Handle,true);//本示例在windows mobile 6.1下测试通过
源地址:http://www.cnblogs.com/sohighthesky/archive/2010/02/23/shfullscreen.html