private void Panel_DoubleClick(object sender, EventArgs e) { ThumbnailPanel obj = (ThumbnailPanel)sender; obj.site.getImage(obj.sub.pageSource.ToString()); obj.BackColor = Color.FromArgb(255, 100, 200, 200); }
private void updateGallery(object sender, EventArgs e) { Website obj = (Website)sender; while (true) { try { Submission sub = obj.getNextImage(); if (sub.title == null) { break; } ThumbnailPanel panel = new ThumbnailPanel(sub, obj); panel.Size = new Size(200, 240); panel.BackColor = Color.FromArgb(50, 0, 0, 0); panel.BackgroundImage = sub.thumbnail; panel.BackgroundImageLayout = ImageLayout.Center; panel.Click += Panel_Click; panel.DoubleClick += Panel_DoubleClick; Label label = new Label(); label.Size = new Size(200, 20); label.Anchor = AnchorStyles.Bottom; label.Text = sub.title; label.Location = new Point(0, 220); panel.Controls.Add(label); if (InvokeRequired) { this.Invoke(new MethodInvoker(delegate { flowLayoutPanel1.Controls.Add(panel); })); } } catch (Exception se) { Console.WriteLine(se); } } }
private void Panel_Click(object sender, EventArgs e) { ThumbnailPanel obj = (ThumbnailPanel)sender; obj.BackColor = Color.FromArgb(200, 255, 0, 0); if (Form.ModifierKeys == Keys.Control) { panels.Add(obj); } else { foreach (ThumbnailPanel panel in panels) { panel.BackColor = Color.FromArgb(50, 0, 0, 0); } panels.Clear(); panels.Add(obj); } }