I have an application and want it to run in full screen mode, without a taskbar. I learned how to hide the window bar, but when I launch my application, it does not cover the Windows taskbar space, although the latter is hidden.
I found this , but it did not work. I could not find examples of this to flinch. I have FormBorderStyle = None and WindowsState = Maximized
DECISION:
I found a way to do this. An important tip is having WindowState = Normal (it took me a while to find this problem). If you have WindowState = Maximized, you cannot set the height of the form to the maximum height of the display.
I wrote this code to test it and it works fine. It is a form with two buttons: button1 (fullscreen) and button2 (restore the 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 this helps others with the same problem!
Thanks for the help!