void item_ClickItem(object sender, EventArgs e) { IconItem item = (IconItem)sender; m_sIconUrl = item.Icon; this.DialogResult = DialogResult.OK; this.Close(); }
void LoadList() { this.flowLayoutPanel.Controls.Clear(); string sPath = Application.StartupPath + "\\MenuIcon\\"; if (!Directory.Exists(sPath)) { Directory.CreateDirectory(sPath); } DirectoryInfo di = new DirectoryInfo(sPath); FileInfo[] fs = di.GetFiles(); foreach (FileInfo fi in fs) { IconItem item = new IconItem(); item.Icon = fi.FullName; item.ClickItem += new ClickEventHandler(item_ClickItem); flowLayoutPanel.Controls.Add(item); } }