且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

TabControl不显示

更新时间:2023-11-14 15:49:34

将newPage选项卡添加到tabControl,但是你从不添加tabControl到你的表单。试试这个...



You add the newPage tab to the tabControl, but you never add the tabControl to your form. Try this...

private void Form1_Load(object sender, EventArgs e)
{
    TabPage newPage = new TabPage("New Page");
    TabControl tabControl = new System.Windows.Forms.TabControl();
    tabControl.TabPages.Add(newPage);
    this.Controls.Add(tabControl);
}


谢谢...我看到的演示必须通过设计师添加代码,但无论如何,这确实有效...非常感谢...
Thank you...the demos I saw must have had that code added perhaps via the designer but in any event, that did work...thanks a lot...