我想根据我传入的参数动态的生成Label ,但类型转换不过来,请问各位大虾如何做啊!????
private void GreatePic(System.Windows.Forms.Label Lb,string LbText,string Level ,string Name)
{
System.Windows.Forms.Label lb=(System.Windows.Forms.Label)("label"+Level);
// System.Windows.Forms.Label lb=new Label();
this.panel1.Controls.Add( lb);
lb.Location = new System.Drawing.Point(264, 24);
lb.Name = Name+Level;
lb.Size = new System.Drawing.Size(72, 23);
lb.TabIndex = 25;
lb.Text = LbText;
}
private void GreatePic(System.Windows.Forms.Label Lb,string LbText,string Level ,string Name)
{
System.Windows.Forms.Label lb=(System.Windows.Forms.Label)("label"+Level);
// System.Windows.Forms.Label lb=new Label();
this.panel1.Controls.Add( lb);
lb.Location = new System.Drawing.Point(264, 24);
lb.Name = Name+Level;
lb.Size = new System.Drawing.Size(72, 23);
lb.TabIndex = 25;
lb.Text = LbText;
}
label1.Location = new System.Drawing.Point(x, y);
label1.Name = "XXXX";
label1.Text = "XXXX";
System.Windows.Forms.Label lb=new System.Windows.Forms.Label();
lb.ID="label"+Level;