Lossless Image Resizing in C# - Completing the Project
(Page 5 of 6 )
Now that we've finished writing our method and function, we can complete our project by adding the code snippets to the appropriate components to develop those parts which will execute when we click on btnResize and saveFileDialog2's OK button after choosing the destination location. Check 'em out!
private void btnResize_Click(object sender, EventArgs e)
{
saveFileDialog2.Filter = "Joint Photographic Experts Group Format (*.jpg)|*.jpg|" +
"Graphics Interchange Format (*.gif)|*.gif|" + "Bitmap Format (*.bmp)|*.bmp|" +
"Portable Network Graphics Format (*.png)|*.png";
saveFileDialog2.ShowDialog();
}
private void saveFileDialog2_FileOk(object sender, CancelEventArgs e)
{
string NewFileName = saveFileDialog2.FileName;
string NewFileExtension = NewFileName.Substring(NewFileName.Length - 3, 3);
ResizeImage(Int32.Parse(txtWidth.Text), Int32.Parse(txtHeight.Text),
SelectPicture.FileName, NewFileName, NewFileExtension);
}
You see? After completing these blocks of code, we have finished our Lightweight Image Manipulation application. Now just head over to the next page because that's the location to download the archived source code of this entire project. You will also l find some of my closing thoughts and final words regarding this tutorial.
Next: Final Words >>
More C# Articles
More By Barzan "Tony" Antal