Here I am trying to create a picture viewer application using C# in Visual studio 2008.Through this application we can view and can convert images from one type to another.
Create a windows application and name it as PictureViewer.Then add openFileDialog, saveFileDialog,panel, pictureBox,menuStrip and three buttons to the form and name it as I did.Add three menu items and name as Open,Save As and Exit.Then our UI will look like this.
Open
When we click Open in File menu, an openFileDialog will come and we can select the image we want to open.For this add following code to the click event of Open.
OpenImage() function is shown below.
Save As
Add the following code to the click event of Save As
Function SaveImage() is shown below.
Function for SaveAsType() is shown below.
Rotate clockwise and anticlockwise
The following is the function for rotating an image.
Add the following code to click event of Rotate clockwise button.
Add the following code to click event of Rotate Anticlockwise button.
Next
To view the next image in the folder,add the following code to the click event of Next button.
Our project is finished and run the code by pressing F5 and open an image.then our application wil looks like this.