int angle = 0;//角度
graphics.RotateTransform(angle, MatrixOrderAppend);
graphics.TranslateTransform(0, 0, MatrixOrderAppend);//
graphics.DrawImage(&image, 0, 0, width, height);//
graphics.ResetTransform();
不是很好用的方法:
width = image.GetWidth();
height = image.GetHeight();
//绘图
Graphics graphics(hdcBuffer);
graphics.DrawImage(&image, 0, 0, width, height);//原图
//旋转90度
nX = width + 5;
nY = 0;
Point points90[] = {
Point(nX + height, nY),
Point(nX + height, nY + width),
Point(nX, nY) };
graphics.DrawImage(&image, points90, 3);//
// 旋转180度图像的输出位置
nX = width + height + 10;
nY = 0;
Point points180[] = {
Point(nX + width, nY + height),
Point(nX, nY + height),
Point(nX + width, nY) };
graphics.DrawImage(&image, points180, 3);
// 初始化GDI+
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
Image image(TEXT(".\\img\\61.png"));
int width = image.GetWidth();
int height = image.GetHeight();
Graphics graphics(hdcBuffer);
graphics.RotateTransform(angle, MatrixOrderAppend);//旋转角度-150-150
graphics.TranslateTransform(x+21.5, y+21.5, MatrixOrderAppend);//旋转坐标(x,旋转的横坐标+相对坐标)(y纵坐标+相对坐标)
graphics.DrawImage(&image, 4, 0, -width, -height);//旋转区域(旋转点坐标(0,0)为右下角,需要改为图标中心点旋转)
graphics.ResetTransform();
Gdiplus::GdiplusShutdown(gdiplusToken);