Image Rotation C # example:
Private void rotatetransform_click (Object sender, system. eventargs E)
{
Graphics graphics = This. creategraphics ();
Graphics. Clear (color. White );
// Load the image
Bitmap image = new Bitmap ("nemo.bmp ");
// Obtain the center of the current window
Rectangle rect = new rectangle (0, 0, this. clientsize. Width, this. clientsize. Height );
Pointf center = new pointf (rect. width/2, rect. Height/2 );
Float offsetx = 0;
Float offsety = 0;
Offsetx = center. X-image.Width/2;
Offsety = center. Y-image.Height/2;
// Create an image display area: make the center of the image consistent with the center of the window
Rectanglef picrect = new rectanglef (offsetx, offsety, image. Width, image. Height );
Pointf pcenter = new pointf (picrect. x + picrect. width/2,
Picrect. Y + picrect. Height/2 );
// Rotate the image around the center for one week
For (INT I = 0; I <361; I + = 10)
{
// The drawing plane is rotated at the center of the image.
Graphics. translatetransform (pcenter. X, pcenter. y );
Graphics. rotatetransform (I );
// Restore the horizontal and vertical translation of the drawing plane
Graphics. translatetransform (-pcenter. X,-pcenter. y );
// Draw the image and delay it
Graphics. drawimage (image, picrect );
Thread. Sleep (100 );
// Reset all transformations of the drawing plane
Graphics. resettransform ();
}
}