private void AddImage(string imageFilename, int imageNumber) { // thread safe if (this.InvokeRequired) { this.Invoke(m_AddImageDelegate, imageFilename, imageNumber); } else { int size = ImageSize; ImageViewerCtrl ImageViewerCtrl = new ImageViewerCtrl(); ImageViewerCtrl.Dock = DockStyle.Bottom; ImageViewerCtrl.LoadImage(imageFilename, 256, 256); ImageViewerCtrl.TempImageLocation = Path.GetTempPath() + Path.GetFileName(imageFilename); ImageViewerCtrl.ImageBytes = File.ReadAllBytes(imageFilename); ImageViewerCtrl.Width = size; ImageViewerCtrl.Height = size; ImageViewerCtrl.IsThumbnail = true; //ImageViewerCtrl.Tag = ImageViewerCtrl.MouseClick += new MouseEventHandler(ImageViewerCtrl_MouseClick); this.OnImageSizeChanged += new ThumbnailImageEventHandler(ImageViewerCtrl.ImageSizeChanged); ImageViewerCtrl.MouseEnter += new EventHandler(ImageViewerCtrl_MouseEnter); this.flowLayoutPanelMain.Controls.Add(ImageViewerCtrl); } }
void ImageViewerCtrl_MouseEnter(object sender, EventArgs e) { try { if (panel11.Parent != (ImageViewerCtrl)sender) { m_ActiveImageViewerCtrl = (ImageViewerCtrl)sender; panel11.Location = new Point(((ImageViewerCtrl)sender).Width - panel11.Width - 3, ((ImageViewerCtrl)sender).Height - panel11.Height - 3); panel11.BringToFront(); panel11.Visible = true; panel11.Parent = (ImageViewerCtrl)sender; } } catch { } }