文件名称:C#动态添加控件源代码
文件大小:914B
文件格式:TXT
更新时间:2012-01-05 10:12:35
动态添加控件
在C#下,动态添加控件源代码,pic name = "image_" + i.ToString(); PictureBox pb = new PictureBox(); pb.Name = name; pb.Image = (Image)Properties.Resources.ResourceManager.GetObject(sImage); pb.Tag = "test"; this.Controls.Add(pb); pb.Width=23; pb.Height =23; int x = Convert.ToInt32( 80 + 27.85 * (i % 27)); int y=Convert.ToInt32(33 + 28 * (i / 27)); pb.Location = new System.Drawing.Point(x,y);