private void SetupScreenshot(Screenshot screenshot) { screenshot.Width = this.Width - 22; screenshot.Height = 150; screenshot.Top = _countItems * 150; screenshot.IsSelected = false; screenshot.MouseEnter += screenshot_MouseEnter; screenshot.Click += screenshot_Click; }
private void InitializeControls() { if (_imageURIs != null) { this.Controls.Clear(); if(_screenshots == null) _screenshots = new List<Screenshot>(); _screenshots.Clear(); _countItems = 0; foreach (string uri in _imageURIs) { Screenshot screenshot = new Screenshot(); SetupScreenshot(screenshot); screenshot.LoadScreenshot(uri); screenshot.IsSelected = (_countItems == 0); screenshot.Tag = _countItems; this.Controls.Add(screenshot); _screenshots.Add(screenshot); _countItems++; } //As defaulting to select the first element I also raise selection event after first init _currentlySelected = 0; if (ScreenshotSelected != null) ScreenshotSelected(this, _screenshots[0].ScreenshotImage); //Now checking if it is necessary to add the scrollbar if ((_screenshots.Count * 150) > this.Height) { scroller = new ScrollBarEx(); scroller.BringToFront(); scroller.Orientation = ScrollBarOrientation.Vertical; scroller.BorderColor = Color.FromArgb(64, 64, 64); scroller.Dock = DockStyle.Right; scroller.Visible = true; scroller.Maximum = (_screenshots.Count - 1) * 150; scroller.Scroll += scroller_Scroll; this.MouseWheel += screenshot_MouseWheel; this.Controls.Add(scroller); } else if (scroller != null) { scroller.Scroll -= scroller_Scroll; scroller.Dispose(); scroller = null; } } }
private void AppendScreenshotControl(string ImageURI) { _countItems++; Screenshot screenshot = new Screenshot(); SetupScreenshot(screenshot); screenshot.LoadScreenshot(ImageURI); this.Controls.Add(screenshot); }
private void AppendScreenshotControl(Screenshot screenshot) { _countItems++; SetupScreenshot(screenshot); this.Controls.Add(screenshot); }
public void AddScreenshot(Screenshot screenshot) { _screenshots.Add(screenshot); AppendScreenshotControl(screenshot); }