I have my app and want to make it run in full-screen mode, no task-bar. I found out how to hide the windows bar but when I start my app it doesn't cover the space of the windows task-bar, despite this last is hidden.
I found this but it didn't work. I couldn't find examples of this regarding to wince. I have FormBorderStyle = None, and WindowsState = Maximized
SOLUTION:
I find a way of doing it. An important tip is to have the WindowState = Normal(it took me some time to find this problem). If you have WindowState = Maximized you can't set the Form's height to the maximum display's height.
I wrote this code to probe it and it work ok. Is a Form with two buttons: button1(fullscreen) and button2(restore default screen)
public partial class Form1 : Form
{
public Form1(){
InitializeComponent();
}
[DllImport("Coredll")]
internal static extern IntPtr FindWindow(String lpClassName, String lpWindowName);
[DllImport("coredll.dll")]
internal static extern bool EnableWindow(IntPtr hwnd, Boolean bEnable);
[DllImport("coredll.dll")]
private static extern bool MoveWindow(IntPtr hWnd, int x, int y, int cx, int cy, bool repaint);
public static bool EnableTaskBar(Boolean enable)
{
IntPtr hwnd;
hwnd = FindWindow("HHTaskBar", "");
if (enable) SetHHTaskBar();
else HideHHTaskBar();
return EnableWindow(hwnd, enable);
}
public static void HideHHTaskBar()
{
IntPtr iptrTB = FindWindow("HHTaskBar", null);
MoveWindow(iptrTB, 0, Screen.PrimaryScreen.Bounds.Height,
Screen.PrimaryScreen.Bounds.Width, 26, true);
}
public static void SetHHTaskBar()
{
IntPtr iptrTB = FindWindow("HHTaskBar", null);
MoveWindow(iptrTB, 0, 294,
Screen.PrimaryScreen.Bounds.Width, 26, true);
}
private void button1_Click(object sender, EventArgs e)
{
EnableTaskBar(false);
this.Width = Screen.PrimaryScreen.Bounds.Width;
this.Height = Screen.PrimaryScreen.Bounds.Height;
this.Left = 0;
this.Top = 0;
}
private void button2_Click(object sender, EventArgs e)
{
EnableTaskBar(true);
}
}
Hope it helps others with the same problem!
Thanks for the help!
After hiding the task bar, explicitly set the size and position of your Form:
myForm.Width = Screen.PrimaryScreen.Bounds.Width;
myForm.Height = Screen.PrimaryScreen.Bounds.Height;
myForm.Left = 0;
myForm.Top = 0;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With