-1

I am having some trouble trying to get a windows form project go full screen and to hide the taskbar. I am inheriting forms from a master form. When I add the following code it still shows the task bar at the bottom.

this.TopMost = true;
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
this.Bounds = Screen.PrimaryScreen.Bounds;

When I try the above code in a different win forms project without inherited forms it works.

What do I need to do in inherited forms to get the form to go full screen?

Inkey
  • 2,189
  • 9
  • 39
  • 64
  • In what way is it "inherited"? Are any of those properties being modified by the inherited form class? – David Arno Jun 22 '15 at 13:13
  • It inherits controls from a master form I have tried to modify them in both the master form and the child form. – Inkey Jun 22 '15 at 13:15
  • The top answer [here](http://stackoverflow.com/questions/505167/how-do-i-make-a-winforms-app-go-full-screen) is highly upvoted. I would assume it works. Note the caveat about the order of setting the properties. Maybe the problem is that you're setting the bounds when you don't need to? – adv12 Jun 22 '15 at 13:16

1 Answers1

2

You have to decide: Either maximize the form (which always makes sure the TaskBar is still visible) or set the dimensions manually. I suggest you remove the WindowState line.

Another failsafe way would be to hide the TaskBar from your code, for example as described here.

Community
  • 1
  • 1
Thorsten Dittmar
  • 55,956
  • 8
  • 91
  • 139