Hi, it's possible to create a fullscreen app using SHFullScreen
function from aygshell.dll. Take a look on following code snippet:
public static bool SetTaskBarEnabled(bool enabled)
{
IntPtr hwnd = Win32Window.FindWindow("HHTaskBar", null);
return Win32Window.EnableWindow(hwnd, enabled);
}
[DllImport("aygshell.dll", EntryPoint="SHFullScreen",
SetLastError=true)]
private static extern bool SHFullScreen(IntPtr apphwnd, int state);
const int SHFS_SHOWTASKBAR = 0x1;
const int SHFS_HIDETASKBAR = 0x2;
const int SHFS_SHOWSIPBUTTON = 0x4;
const int SHFS_HIDESIPBUTTON = 0x8;
const int SHFS_SHOWSTARTICON = 0x10;
const int SHFS_HIDESTARTICON = 0x20;
const int SWP_NOZORDER = 0x4;
private const int HHTASKBARHEIGHT = 26;
/* private const int SHFS_HIDETASKBAR = &H2;
private const int SWP_NOZORDER = &H4;*/
public static bool HideTaskBarForWindow(IntPtr hwnd)
{
Rectangle rect = Win32Window.GetWindowRect(hwnd);
int width = rect.Right - rect.Left;
int height = rect.Bottom - rect.Top;
SHFullScreen(hwnd, SHFS_HIDETASKBAR);
Win32Window.SetWindowPos(hwnd, OpenNETCF.Win32.HWND.TOPMOST, 0,
0, width, height + HHTASKBARHEIGHT, SWP.NOZORDER);
return true;
}
public static bool SetStartButtonVisible(bool visible, IntPtr hwnd)
{
if (hwnd.ToInt32() > 0)
{
return SHFullScreen(hwnd, visible ? SHFS_SHOWSTARTICON :
SHFS_HIDESTARTICON);
}
else
{
return false;
}
}
public static bool ShowTaskBarForWindow(IntPtr hwnd)
{
Rectangle rect = Win32Window.GetWindowRect(hwnd);
int width = rect.Right - rect.Left;
int height = rect.Bottom - rect.Top;
SHFullScreen(hwnd, SHFS_SHOWTASKBAR);
Win32Window.SetWindowPos(hwnd, OpenNETCF.Win32.HWND.TOPMOST, 0,
HHTASKBARHEIGHT, width, height - HHTASKBARHEIGHT, SWP.NOZORDER);
return true;
}
Engin AYDOGAN napsal:
I want to make my application to use the whole screen, searched through
msdn and it suggests to use `WindowState = FormWindowState.Maximized;'
in the (only) Form of the program, but it doesn't work. I still can see
the taskbar and title bar. I've tried placing above statment to few
places (i.e. in c-tor/onLoad of the form, etc), still no go.
Any ideas ?