FullScreen

  • Thread starter Thread starter BJ
  • Start date Start date
B

BJ

Hi,

How do you do a FullScreen option for you program during running? I want to
display my form in full but right now, the task bar on the bottom's still
shown.
 
BJ said:
Hi,

How do you do a FullScreen option for you program during running? I want to
display my form in full but right now, the task bar on the bottom's still
shown.

When you want to go Full Screen, simply set your form's FormBorderStyle to
FormBorderStyle.None and its WindowState to FormWindowState.Maximized. This
will hide the taskbar for you. You can do that at run time without any
problem. If your form has a menu it will still be visible though; you'll
have to remove the menu from your form's controls yourself if you want it to
be hidden when in Full Screen Mode.

As a side note, i've noticed that doing what i've described above doesn't
work if the form is already maximized. In this case, the task bar remains
shown. My workaround is to set the form's WindowState first to
FormWindowState.Normal and then to FormWindowState.Maximized. This works
everytime but produces a very annoying flickering. If anybody has a better
idea, i'd be glad to hear it.
 
Use the style of the form to switch showing title bar or not.
Override CreateParams method like this,
protected override CreateParams CreateParams
{
get
{
// Extend the CreateParams property of the Button class.
CreateParams cp = base.CreateParams;
// Update the Caption Style.(WS_CAPTION)
if(isFullScreen)
cp.Style ^= 0x00C00000; // No title bar
else
cp.Style |= 0x00C00000; // Show title bar
return cp;
}
}

Then call UpdateStyle method to change the style. At same time maximized the
form.

hope it helps
 
Back
Top