Get the index of a control
Hi,
I've developed a componant witch create dynamically others componants inside, my method is :
private void DrawPanel(int index, string nom, string caption)
{
top=top+50;
PanelXP Pic = new PanelXP();
Pic.caption_panel=caption;
if (index==1)
{
Pic.img_panel="Panel1.bmp";
Pic.Top=top;
}
else
{
Pic.img_panel="Title.bmp";
Pic.Top=top;
}
Pic.Left=10;
Pic.Name=nom;
Pic.Index=index;
Pic.Click+= new System.EventHandler(this.RedrawPanels);
Pic.DrawPanel();
this.Controls.Add(Pic);
foreach (ClsSubPanel c in TabSubPanel)
{
if (c.itemPanel==nom)
DrawSubPanel(c.index,c.itemPanel,c.namesub,c.captionSub);
}
}
I like to know when I click on the componant each index of each instance of Pic. And when I introduce the componant in a form I like to have the same result.
Somebody has an idea?
Thanks