C# label 控件数组的Click事件怎么写?
Label[]img=newLabel[9];for(inti=0;i<9;i++){img[i]=newLabel();panel1.Controls.Add(img[...
Label[] img = new Label[9];
for (int i = 0; i < 9; i++)
{
img[i] = new Label();
panel1.Controls.Add(img[i]);
img[i].Location = pArray[i];
}
要写出它的单击事件,怎么写啊?(一组的) 展开
for (int i = 0; i < 9; i++)
{
img[i] = new Label();
panel1.Controls.Add(img[i]);
img[i].Location = pArray[i];
}
要写出它的单击事件,怎么写啊?(一组的) 展开
1个回答
展开全部
Label[] img = new Label[9];
for (int i = 0; i < 9; i++)
{
img[i] = new Label();
panel1.Controls.Add(img[i]);
img[i].Location = pArray[i];
img[i].click+= new EventHandler(test_click);
}
private void test_click(object sender, EventArgs e)
{
}
for (int i = 0; i < 9; i++)
{
img[i] = new Label();
panel1.Controls.Add(img[i]);
img[i].Location = pArray[i];
img[i].click+= new EventHandler(test_click);
}
private void test_click(object sender, EventArgs e)
{
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询