动态生成控件,需要为控件添加click。但是出现了重复赋值的问题,求哪位前辈能够指点一下!

for (int i = 0; i < FtnList.BACHModuleList.Count; i++)
            {
                PictureBox pb = new PictureBox();
                Point pbLocation = new Point(HS + (i + 1) * 100 - 250, PicVS);
                pb.Width = 65;
                pb.Height = 65;
                pb.BackColor = Color.FromArgb(105, 164, 194);
                pb.Location = pbLocation;
                pb.Name = "pic" + FtnList.BACHModuleList[i].Name;
                pb.BackgroundImage = Properties.Resources.Arrow_Right;
                             
                pb.Click += pictureBox0_Click;//new System.EventHandler(pictureBox0_Click);                   
                    pb.Click += pictureBox1_Click;//new System.EventHandler(pictureBox1_Click);       
                          
                this.Controls.Add(pb);

 

<hr/>              

<hr/>

<hr/>

  private void pictureBox0_Click(object sender, System.EventArgs e)
        {
            
        }

 

画 线那段,究竟该怎么写?跪求指导!


HUH函数
浏览 582回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java