public void RefreshPictures() { DImgPic = null; panelList.Controls.Clear(); if (m_app != null) { try { ImgPicture prevPicture = null; for (int i = 0; i < m_app.Pictures.Count; i++) if (m_app.Pictures[i].W < 2000) { ImgPicture imgPicture = new ImgPicture(); if (prevPicture == null) imgPicture.Location = new Point(0, 0); else imgPicture.Location = new Point(0, prevPicture.Location.Y + prevPicture.Height); imgPicture.No = i; imgPicture.Size = new Size((panelList.Width > 24) ? panelList.Width - 24 : 0, 10); panelList.Controls.Add(imgPicture); imgPicture.Visible = true; imgPicture.Focus(); imgPicture.MouseDown += new MouseEventHandler(imgPicture_MouseDown); imgPicture.DoubleClick += new EventHandler(imgPicture_DoubleClick); imgPicture.ContextMenuStrip = contextMenu; imgPicture.App = m_app; imgPicture.ViewPic(Color.White, Brushes.Black); prevPicture = imgPicture; } } catch (Exception ex) { MessageBox.Show(ex.Message); } label1.Text = m_app.Pictures.Count.ToString(); } }
private void imgPicture_MouseDown(object sender, EventArgs e) { try { ImgPicture imgpicture = (ImgPicture)sender; if (DImgPic != null) { DImgPic.ViewPic(panelList.BackColor, Brushes.Black); } DImgPic = imgpicture; DImgPic.ViewPic(Color.Blue, Brushes.White); PicSelect(DImgPic.No, null); } catch { } }