Question

I have two simple forms designed in maximized view. when switching between them (showing second and hiding first), the second form first shows its header for some miliseconds. Than the header dissapears.

How to avoid showing the header?

Thanks.

Was it helpful?

Solution

This is a tricky one. You can use SetWindowsPos windows api call. To move the header out from the screen. Then when closing the application or on a crash you can put it back. This trick can cause some problems, when there are background stuff happening in windows. I use this only when switching between .exe - form files.

I think a better solution for this problem is to use one Form, but have different UserControls. It will look something like this.

public class MainForm : Form
{
    public void AddView(UserControl view)
    {
        SuspendLayout();
        Controls.Add(view);
        ResumeLayout(true);
    }
}

OTHER TIPS

Have you set the FormBorderSytle to None?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top