我从目录中获取图片列表并将文件名存储在List<String>
. 然后我遍历其中的每一个并PictureBox
为它们中的每一个创建一个,然后我为每个添加相同的点击事件。控件位于FlowLayoutPanel
foreach(String file in this._files){
PictureBox box = new PictureBox();
box.Height = 50;
box.Width = 50;
box.ImageLocation = file;
box.SizeMode = PictureBoxSizeMode.Zoom;
box.Click += this.PictureClick;
this.flowLayoutPanel1.Controls.Add(box);
}
private void PictureClick(object sender, EventArgs e){
// how do I get the one that has been clicked and set its border color
}
如何获取已单击的并设置其边框颜色?