C#动态生成的多个picturebox,怎么选中一个并添加事件
举个例子PictureBox[]pb=newPictureBox[10];for(inti=1;i<=10;i++){pb[i]=newPictureBox();pb[i...
举个例子
PictureBox[] pb = new PictureBox[10];
for(int i=1;i<=10;i++){
pb[i] = new PictureBox();
pb[i].Name = "pictureBox" + i.ToString();
pb[i].Location = new Point((41*i+10),21);
pb[i].Size = new System.Drawing.Size(71, 96);
this.groupBox1.Controls.Add(pb[i]);
pb[i].Load("C:/Users/Administrator/Desktop/1/images/" + array[i] + ".gif");
}
那么我现在想要给每个pictureBox添加事件,怎么写或者任选一个添加事件 展开
PictureBox[] pb = new PictureBox[10];
for(int i=1;i<=10;i++){
pb[i] = new PictureBox();
pb[i].Name = "pictureBox" + i.ToString();
pb[i].Location = new Point((41*i+10),21);
pb[i].Size = new System.Drawing.Size(71, 96);
this.groupBox1.Controls.Add(pb[i]);
pb[i].Load("C:/Users/Administrator/Desktop/1/images/" + array[i] + ".gif");
}
那么我现在想要给每个pictureBox添加事件,怎么写或者任选一个添加事件 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询