Problem with ToolStrip - controls in Content Panel appear under ToolStrip

I have a UserControl that has a ToolStipContainer, with a ToolStrip in the top Panel, 4 UserControls and a WebBrowser control in the Content Panel. On the ToolStrip I have buttons to select the current control. When a control is selected, it is supposed to fill the Content Panel.

The problem is, the WebBrowser and one of the UserControls in the Content Panel are under the ToolStrip! The other 3 UserControls appear under the ToolStrip, in the Content Panel, as they should. All 5 controls have the same position (0,0) and have default layout options (no docking, only left/top anchors). For some reason, two controls are under the ToolStrip when at location (0,0) but the three others are not. [Edit] Everything looks correct in the designer, the problem only appears at run-time. [/Edit]

Is there some reason that this would happen I'm totally stumped by this, it doesn't make any sense to me. Is there something odd about the Content Panel

Thanks,
Erick



Answer this question

Problem with ToolStrip - controls in Content Panel appear under ToolStrip

  • MorenaMx

    Did you check inside the InitializeComponent() method that

    this.toolStripContainer1.ContentPanel.Controls.Add(-- Controls That should be in the ContentPanel);

    and not:

    this.toolStripContainer1.TopToolStripPanel.Controls.Add(-- Controls That should be in the ContentPanel);



  • shani241982

    I did, and all the controls were being added to the same place, the Content Panel. The really odd part was that the controls all were placed correctly at design time, but not at run time. I'm using the past tense, as I've pulled the use of the container until I figure this bug out.

    Thanks,
    Erick


  • Problem with ToolStrip - controls in Content Panel appear under ToolStrip