Пример #1
0
            private void _thumbnail_MouseDown(object sender, MouseEventArgs e)
            {
                NuGenThumbnail activeThumbnail = (NuGenThumbnail)sender;

                _selectionService.AddImage(activeThumbnail.Image, Control.ModifierKeys, Control.MouseButtons);
                this.RefreshThumbnailSelection();
            }
Пример #2
0
            public void RebuildLayout()
            {
                int preferredThumbnailSize = this.ThumbnailSize;
                int width          = this.DisplayRectangle.Width;
                int thumbnailCount = Math.Max(1, width / preferredThumbnailSize);

                int actualThumbnailSize = Math.Min(
                    width - _thumbnailMargin * 2
                    , width / thumbnailCount - _thumbnailMargin * (thumbnailCount + 1)
                    );

                Size thumbnailSize = new Size(actualThumbnailSize, actualThumbnailSize);

                foreach (Control ctrl in this.Controls)
                {
                    NuGenThumbnail thumbnail = ctrl as NuGenThumbnail;

                    if (thumbnail != null)
                    {
                        thumbnail.Size = thumbnailSize;
                    }
                }

                this.RefreshThumbnailNums();
            }
			private void _imageTracker_ImageAdded(object sender, AddImageEventArgs e)
			{
				Image image = e.Image;
				NuGenThumbnail thumbnail = new NuGenThumbnail(_serviceProvider);
				thumbnail.Image = image;
				_imageThumbDictionary.Add(image, thumbnail);
				_ctrls.Add(thumbnail);
			}
Пример #4
0
 private void RefreshThumbnailNums()
 {
     for (int i = 0; i < _thumbnailManager.Images.Count; i++)
     {
         NuGenThumbnail currentThumb = _thumbnailManager.GetThumbnailFromImage(_thumbnailManager.Images[i]);
         currentThumb.Text = (i + 1).ToString(CultureInfo.CurrentUICulture);
     }
 }
			private void _imageTracker_ImageInserted(object sender, InsertImageEventArgs e)
			{
				Image image = e.Image;
				NuGenThumbnail thumbnail = new NuGenThumbnail(_serviceProvider);
				thumbnail.Image = image;
				_imageThumbDictionary.Add(image, thumbnail);
				_ctrls.Add(thumbnail);
				_ctrls.SetChildIndex(thumbnail, e.Index);
			}
 private void _imageTracker_ImageRemoved(object sender, RemoveImageEventArgs e)
 {
     if (_imageThumbDictionary.ContainsKey(e.Image))
     {
         NuGenThumbnail thumbnail = _imageThumbDictionary[e.Image];
         _imageThumbDictionary.Remove(e.Image);
         _ctrls.Remove(thumbnail);
     }
 }
            private void _imageTracker_ImageAdded(object sender, AddImageEventArgs e)
            {
                Image          image     = e.Image;
                NuGenThumbnail thumbnail = new NuGenThumbnail(_serviceProvider);

                thumbnail.Image = image;
                _imageThumbDictionary.Add(image, thumbnail);
                _ctrls.Add(thumbnail);
            }
            private void _imageTracker_ImageInserted(object sender, InsertImageEventArgs e)
            {
                Image          image     = e.Image;
                NuGenThumbnail thumbnail = new NuGenThumbnail(_serviceProvider);

                thumbnail.Image = image;
                _imageThumbDictionary.Add(image, thumbnail);
                _ctrls.Add(thumbnail);
                _ctrls.SetChildIndex(thumbnail, e.Index);
            }
Пример #9
0
            protected override void OnControlRemoved(ControlEventArgs e)
            {
                base.OnControlRemoved(e);
                NuGenThumbnail thumbnail = e.Control as NuGenThumbnail;

                if (thumbnail != null)
                {
                    thumbnail.Rotate90CWButtonClick  -= _thumbnail_Rotate90CWButtonClick;
                    thumbnail.Rotate90CCWButtonClick -= _thumbnail_Rotate90CCWButtonClick;
                    thumbnail.DoubleClick            -= _thumbnail_DoubleClick;
                    thumbnail.MouseDown -= _thumbnail_MouseDown;
                }
            }
Пример #10
0
            private void RefreshThumbnailSelection()
            {
                foreach (Image image in _thumbnailManager.Images)
                {
                    NuGenThumbnail thumbnail = _thumbnailManager.GetThumbnailFromImage(image);
                    thumbnail.Checked = false;
                }

                foreach (Image image in _selectionService.SelectedImages)
                {
                    NuGenThumbnail selectedThumbnail = _thumbnailManager.GetThumbnailFromImage(image);
                    selectedThumbnail.Checked = true;
                }
            }
Пример #11
0
            private void _thumbnail_Rotate90CCWButtonClick(object sender, EventArgs e)
            {
                NuGenThumbnail thumbnail = (NuGenThumbnail)sender;

                if (_selectionService.SelectedImages.Contains(thumbnail.Image))
                {
                    foreach (Image selectedImage in _selectionService.SelectedImages)
                    {
                        NuGenThumbnail selectedThumbnail = _thumbnailManager.GetThumbnailFromImage(selectedImage);
                        selectedThumbnail.RotateImage90CCW();
                    }
                }
                else
                {
                    thumbnail.RotateImage90CCW();
                }
            }