开发者

How to add controls to a Tab control

开发者 https://www.devze.com 2023-02-04 05:04 出处:网络
I am using a Tab control in my GUI app and I know how to add and remove tabs开发者_如何学JAVA from it (TCM_INSERTITEM, etc.) but I cannot figure out how to add other controls to a tab like Buttons, et

I am using a Tab control in my GUI app and I know how to add and remove tabs开发者_如何学JAVA 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.)


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.


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

精彩评论

暂无评论...
验证码 换一张
取 消