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 Buttons, etc. How do you add controls to a tab? (Note that I am not a PropertySheet control, but a Tab control.)
问题:
回答1:
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.
回答2:
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.