Embed a form onto a tabcontrol in windows forms

后端 未结 5 1601
你的背包
你的背包 2020-12-11 03:36

I have a tab control in a windows form and I want to be able to click on a tab and in the body area of the tab I want it to display another form as an embedded component. I

5条回答
  •  余生分开走
    2020-12-11 03:57

    I think the other answer has the right idea; Tabbed MDI is probably what you want.

    There is an approach where you create a UserControl that has the same content as the form and use that on the TabPage.

    TabPage myTabPage = new TabPage(sometext);
    myUserControl = new myUserControlType();
    myUserControl.Dock = DockStyle.Fill;
    myTabPage.Controls.Add(myUserControl);
    myTabControl.Add(myTabPage);
    

    http://bytes.com/topic/c-sharp/answers/270457-can-i-add-form-tabpage goes into more detail; but I'd look at the MDI stuff first.

提交回复
热议问题