int imageX = 100, imageY = 100; int imageWidth = 50, imageHeight = 50; float angleDegrees = 45; PointF center(imageX + imageWidth / 2, imageY + imageHeight / 2); Gdiplus::Matrix matrix; matrix.RotateAt(angleDegrees, center); graphics.SetTransform(&matrix); graphics.DrawImage(...); // If we don't do this the next Draw() will also be rotated graphics.ResetTransform();There is also graphics.Rotate(angle) but it doesn't accept a center option. Some code examples suggesting using it and TranslateTransform() but the way above is simpler.
Programming Tips - gdiplus: rotate an image around its center
Date: 2021mar23 Platform: win32 Library: GDI+ Language: C++ Q. gdiplus: rotate an image around its center A. Use Graphics::RotateAt() This changes the state of the graphics class so you'll want to undo that before messing up other things.