I have this code to rotate an image in an if loop in C# Windows Form application, but the Form does not show anything in the form output.
Can anyone help?
if you need to rotate an image on common angles you can use RotateFlip method with ease. Please see my sample code:
string fileName = "somefile.png";
System.Drawing.Imaging.ImageFormat imageFormat = System.Drawing.Imaging.ImageFormat.Png;
Bitmap bitmap =(Bitmap)Bitmap.FromFile(fileName );
//this will rotate image to the left...
bitmap.RotateFlip(RotateFlipType.Rotate270FlipNone);
//lets save result back to file...
bitmap.Save(fileName, imageFormat);
bitmap.Dispose();
That's all, hope it helps.