为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

HUH函数 2018-07-18 11:10:59
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)        {                    } 画 线那段,究竟该怎么写?跪求指导!
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 580 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信