C# winform tabcontrol的tabpage怎么用代码添加,添加完后,怎么在在tabpage里面家text和label?
展开全部
00TabPage tabPage1 = new TabPage();
00this.tabControl1.Controls.Add(this.tabPage1);
00
00tabPage1.Name = "tabPage1";
00tabPage1.TabIndex = 0;
00tabPage1.Text = "tabPage1";
00TextBox textBox1 = new TextBox();
00textBox1.Location = new System.Drawing.Point(0, 0);
00textBox1.Name = "textBox1";
00Label label1 = new System.Windows.Forms.Label();
00label1.Location = new System.Drawing.Point(50, 41);
00label1.Name = "label1";
00tabPage1.Controls.Add(this.label1);
00tabPage1.Controls.Add(this.textBox1);
00this.tabControl1.Controls.Add(this.tabPage1);
00
00tabPage1.Name = "tabPage1";
00tabPage1.TabIndex = 0;
00tabPage1.Text = "tabPage1";
00TextBox textBox1 = new TextBox();
00textBox1.Location = new System.Drawing.Point(0, 0);
00textBox1.Name = "textBox1";
00Label label1 = new System.Windows.Forms.Label();
00label1.Location = new System.Drawing.Point(50, 41);
00label1.Name = "label1";
00tabPage1.Controls.Add(this.label1);
00tabPage1.Controls.Add(this.textBox1);
更多追问追答
追问
00tabPage1.TabIndex = 0;我刚才试验了一下,这句有问题,tabPage1没有TabIndex属性,这是怎么回事?
追答
00是知道排版时不小心给加上去的,tabPage确实没有TabIndex的属性其实没有多大用的,而且VS不会自动提示出来,不过自己写上去不会报错(这是因为它继承了Panel类,所以把tabIndex也继承过来了)
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询