コード例 #1
0
        // -------------------------

        private void SaveAllImagesAsThumbnailsButtonClick(object sender, EventArgs e)
        {
            Cursor currentCursor = this.Cursor;

            this.Cursor = Cursors.WaitCursor;
            try
            {
                foreach (ImageData imageData in this.loadedImages)
                {
                    this.thumbnailImages.Add(ImageSizeConverter.ResizeImage(imageData));
                }
                ImageFileHelper.SaveImagesAsThumbnails(this.thumbnailImages, "thumbnails");
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    this,
                    string.Format("Not all thumbnails could be saved.\r\n\r\nException Message:\r\n{0}", ex.Message),
                    ex.Source,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = currentCursor;
            }
        }
コード例 #2
0
        // ----------------------------------------------

        private void ResizeImageToThumbnailButtonClick(object sender, EventArgs e)
        {
            try
            {
                this.thumbnailImageData             = ImageSizeConverter.ResizeImage(this.originalImageData, new Size((int)(this.originalImageData.Size.Width * 0.15), (int)(this.originalImageData.Size.Height * 0.15)));
                this.thumbnailImagePictureBox.Image = this.thumbnailImageData.Image;
            }
            catch (Exception ex)
            {
                this.ShowException(
                    string.Format("The image could not be resized.\r\n\r\nException Message:\r\n{0}", ex.Message),
                    ex.Source);
            }
        }