c# - WinForm enter fullscreen mode -
this question has answer here:
- how make winforms app go full screen 7 answers
- c# fullscreen, hiding taskbar 2 answers
i have winform application , want enter fullscreen mode , remove bars , task bar. done this:
this.windowstate = formwindowstate.maximized; this.formborderstyle = formborderstyle.none; this.topmost = true; the top bar hidden windows taskbar still visible. idea can trouble?
run full screen can use method..
private void form1_load(object sender, eventargs e) { this.topmost = true; this.formborderstyle = formborderstyle.none; this.windowstate = formwindowstate.maximized; } to hide taskbar add class project .it works expected.
using system; using system.runtime.interopservices; public class taskbar { [dllimport("user32.dll")] private static extern int findwindow(string classname, string windowtext); [dllimport("user32.dll")] private static extern int showwindow(int hwnd, int command); [dllimport("user32.dll")] public static extern int findwindowex(int parenthandle, int childafter, string classname, int windowtitle); [dllimport("user32.dll")] private static extern int getdesktopwindow(); private const int sw_hide = 0; private const int sw_show = 1; protected static int handle { { return findwindow("shell_traywnd", ""); } } protected static int handleofstartbutton { { int handleofdesktop = getdesktopwindow(); int handleofstartbutton = findwindowex(handleofdesktop, 0, "button", 0); return handleofstartbutton; } } private taskbar() { // hide ctor } public static void show() { showwindow(handle, sw_show); showwindow(handleofstartbutton, sw_show); } public static void hide() { showwindow(handle, sw_hide); showwindow(handleofstartbutton, sw_hide); } } usage:
taskbar.hide();
Comments
Post a Comment