C#中 通过代码 把LABEL1放在PANEL里
//Panelpan1Panelpan1=newPanel();pan1.Size=newSize(310,120);pan1.Location=newPoint(4,5...
//Panel pan1 Panel pan1 = new Panel(); pan1.Size = new Size(310, 120); pan1.Location = new Point(4, 55); pan1.BackColor = Color.White; pan1.BorderStyle =BorderStyle.FixedSingle; this.Controls.Add(pan1); //Label l1 Label l1 = new Label(); l1.Text = "QQ帐号"; l1.ForeColor = Color.Black; l1.Size = new Size(20, 20); l1.Location = new Point(200, 170); this.Controls.Add(l1); 想把L1放在PAN1里面
展开
1个回答
展开全部
//Panel pan1 Panel pan1 = new Panel(); pan1.Size = new Size(310, 120); pan1.Location = new Point(4, 55); pan1.BackColor = Color.White; pan1.BorderStyle =BorderStyle.FixedSingle; this.Controls.Add(pan1); //Label l1 Label l1 = new Label(); l1.Text = "QQ帐号"; l1.ForeColor = Color.Black; l1.Size = new Size(20, 20); l1.Location = new Point(200, 170); this.Controls.Add(l1); //只是在这里需要修改一下,因为this.controls表示的是Form的控件集合,改成panel1.Controls即可 this.pan1.Controls.Add(this.l1);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询