您可以使用 Windows Forms TabControl 以有組織的方式來顯示其他控制項。 以下程序示範如何將按鈕新增至第一個索引標籤。如需將圖示新增至索引標籤頁面的標籤部分的詳細資訊,請參閱如何:變更 Windows Forms TabControl 的外觀。
若要以程式設計方式新增控制項
使用 TabPage 的 Controls 屬性傳回的集合的 Add 方法:
tabPage1->Controls->Add(gcnew Button);tabPage1.Controls.Add(new Button());tabPage1.Controls.Add(New Button())