C# - How To Rotate Image In C#
__________________________________________________________________________
In This C# Tutorial We Will See How You Can Flip An Image In CSharp Programming Language .
In This C# Tutorial We Will See How You Can Flip An Image In CSharp Programming Language .
Source Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class Rotate_Image : Form
{
public Rotate_Image()
{
InitializeComponent();
}
Bitmap bmp;
private void Rotate_Image_Load(object sender, EventArgs e)
{
// C:\Users\samsng\Desktop\left_right.png
try
{
bmp = (Bitmap)Bitmap.FromFile(@"C:\Users\samsng\Desktop\left_right.png");
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.Image = bmp;
}
catch(FileNotFoundException)
{
MessageBox.Show("File Not Found Exception");
}
}
private void BTN_ROTATE_Click(object sender, EventArgs e)
{
if(bmp != null)
{
bmp.RotateFlip(RotateFlipType.Rotate180FlipY);
pictureBox1.Image = bmp;
}
}
}
}
=> OutPut :
Rotate Image In C# |
Download Projects Source Code