Rotate and flip images in c# - Tutorial on creating desktop apps in C# language
Автор: ادد المطيري
Загружено: 2022-07-13
Просмотров: 1096
To access the full course in order, click on the link below:-
• how to select file in c# - C# Desktop appl...
Image.RotateFlip(RotateFlipType) Method (System.Drawing)
Rotate Image using RotateFlip in C#
visual studio 2010 - C#: Flip image horizontally
c# - Is there anyway to rotate image -90 degree
c# - Rotate and flip an image
Rotating and Flipping a bitmap
I want to flip a picture box
Image function zoom and rotate
Image RotateFlip ASP.NET C#
Rotating a picture box
C# rotate image
Rotate bitmap C#
how to rotate in c#
rotate image in asp net using c#
Image.RotateFlip(RotateFlipType) Method
Reference
Definition
Namespace:
System.Drawing
Assembly:
System.Drawing.Common.dll
Rotates, flips, or rotates and flips the Image.
C#
public void RotateFlip (System.Drawing.RotateFlipType rotateFlipType);
Parameters
rotateFlipType
RotateFlipType
A RotateFlipType member that specifies the type of rotation and flip to apply to the image.
Examples
The following code example demonstrates how to call the RotateFlip method on an Image and the RotateFlipType enumeration.
This example is designed to be used with a Windows Form that contains a PictureBox named PictureBox1 and a button named Button1. Paste the code into a form, call InitializeBitmap from the form's constructor, and associate Button1_Click with the button's Click event. Ensure the file path to the bitmap is valid on your system.
C#
Bitmap bitmap1;
private void InitializeBitmap()
{
try
{
bitmap1 = (Bitmap)Bitmap.FromFile(@"C:\Documents and Settings\" +
@"All Users\Documents\My Music\music.bmp");
PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
PictureBox1.Image = bitmap1;
}
catch(System.IO.FileNotFoundException)
{
MessageBox.Show("There was an error." +
"Check the path to the bitmap.");
}
}
private void Button1_Click(System.Object sender, System.EventArgs e)
{
if (bitmap1 != null)
{
bitmap1.RotateFlip(RotateFlipType.Rotate180FlipY);
PictureBox1.Image = bitmap1;
}
}
Remarks
The RotateFlip method rotates the image clockwise.
If you wish to draw on an image once it has been rotated, you should always retrieve a new graphics object from the image, otherwise an exception could occur.
source
https://docs.microsoft.com/en-us/dotn...
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: