How to add controls to a Tab control

后端 未结 2 1007
青春惊慌失措
青春惊慌失措 2021-01-14 01:48

I am using a Tab control in my GUI app and I know how to add and remove tabs from it (TCM_INSERTITEM, etc.) but I cannot figure out how to add other controls to a tab like B

相关标签:
2条回答
  • 2021-01-14 01:53

    If you are talking about adding controls to the body of the tab control: You don't.

    What you do is create a child styled dialog control for each tab, which will have the controls for that tab on it. As each tab is selected, you handle the notification from the tab control to create and show the appropriate page control. The page dialogs are normally parented to the parent of the tab control, not the tab control itself.

    0 讨论(0)
  • 2021-01-14 01:56

    While you can certainly specify a tab control as the parent of another control, this isn't going to help you. The tab control will not be aware of its (newly added) children and so it cannot arrange itself to accomodate them.

    So the short answer is: You cannot.

    The long answer is that you have two choices:

    1) Build your own tab control which can support children.

    2) Arrange the other controls along with the tab control such that they fit together, but do not overlap.

    0 讨论(0)
提交回复
热议问题