private void button6_Click(object sender, EventArgs e) { using (ImageEditorForm dlg = new ImageEditorForm()) { if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { LogImage li = new LogImage(); li.FileName = dlg.Filename; li.imgFile = dlg.ImageFilePath; li.Caption = dlg.Caption; li.Description = dlg.Description; _logImages.Add(li); PictureBox pb = new PictureBox(); li.PB = pb; pb.Tag = li; pb.Size = new Size(50, 50); pb.SizeMode = PictureBoxSizeMode.CenterImage; pb.Image = Utils.ImageUtilities.ResizeImage(Image.FromFile(li.imgFile.Path), pb.Width, pb.Height); toolTip1.SetToolTip(pb, li.Caption); pb.ContextMenuStrip = this.contextMenuStrip1; pb.MouseDown += new MouseEventHandler(pb_MouseDown); flowLayoutPanel1.Controls.Add(pb); } else { dlg.Clear(); } } }