// -------------------------------- public static void SaveImageAsThumbnail(ImageData imageData, string relativeThumbnailImagesSubDirectory) { using (FileStream fs = File.OpenWrite(Path.Combine(imageData.Directory, relativeThumbnailImagesSubDirectory, imageData.NameWithoutExtension + "_tn" + imageData.Extension))) { imageData.Image.Save(fs, ImageFormat.Jpeg); } }
// -------------------------------- public static void SaveImage(ImageData imageData) { using (FileStream fs = File.OpenWrite(Path.Combine(imageData.Directory, imageData.NameWithoutExtension + "_tn" + imageData.Extension))) { imageData.Image.Save(fs, ImageFormat.Jpeg); } }
// ---------------------------------------------- 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); } }
// ---------------------------------------------- private void PreviousImageButtonClick(object sender, EventArgs e) { this.PreviousImageByDecrement(); this.imagesListBox.SelectedIndex = this.imagePositionPointer; this.originalImageData = new ImageData(this.imagesDataTable.Rows[this.imagePositionPointer].ItemArray[1].ToString()); }
// ---------------------------------------------- private void ImagesListBoxSelectedIndexChanged(object sender, EventArgs e) { int selectedIndex = ((ListBox)sender).SelectedIndex; this.SelectImageByAbsoluteIndex(selectedIndex); this.originalImageData = new ImageData(this.imagesDataTable.Rows[this.imagePositionPointer].ItemArray[1].ToString()); }