Hi,
I have added no.of images(pictureboxes) in a flowlayoutpanel using openfiledialog.
Now i want to remove the particular control at runtime but i am able to get the particular control.
How can i name the pictureboxes while adding them in flowlayoutcontrol and after adding them how can i get the particular control by either selecting by mouseclick or anything else.
Can i select the added control by mouseclick.
Regards,
Vidya
Loading
Danatas GerviPosted Oct 14, 2009, 11:38 AM
Possible solution:
namespace FlowLayotAndPicures
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
for (int iii = 0; iii <2000; iii+=20)
{
PictureBox onePik = new PictureBox();
onePik.BackColor = ColorTranslator.FromWin32(44444 + iii); //to see the control in pannel
onePik.MouseClick += new MouseEventHandler(onePik_MouseClick);
flowLayoutPanel1.Controls.Add(onePik);
}
}
void onePik_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Middle)
{
flowLayoutPanel1.Controls.Remove(sender as Control);
}
}
}
}