如何将控件添加到Tab控件

问题描述:

我在GUI应用程序中使用了Tab控件,并且我知道如何从中添加和删除选项卡(TCM_INSERTITEM等),但是我不知道如何向选项卡(如Buttons等)中添加其他控件。您将控件添加到选项卡? (请注意,我不是PropertySheet控件,而是Tab选项卡。)

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.)

如果您要向其中添加控件选项卡控件的主体:您不需要。

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.