views:

19

answers:

2

Hello. 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.

A: 

Have you set the FormBorderSytle to None?

ctacke
Yes, I've set the FormBorderSytle to None.
LexRema
+1  A: 

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);
    }
}
Yes, that's a general solution I got to also :). I added a few controls and even managed to add a leaf effect by only changing these controls width. Thanks for reply!
LexRema