I still love using WinForms...
so here is some C# code to rotate an image around an anchor (pivot point) using GDI+
private void
DrawRotatedAtPivot(Graphics g, Image image, Point imageLocation, PointF pivot, int angle)
{
Matrix matrix = new Matrix();
matrix.RotateAt(angle, imageLocation);
g.Transform = matrix;
g.DrawImage(image, (int)(imageLocation.X - image.Width *
pivot.X), (int)(imageLocation.Y - image.Height *
pivot.Y));
g.ResetTransform();
}
Comments
Post a Comment