如何将 System.Drawing.Image 旋转 x 度?
我需要将汽车图像旋转 X 度以指示行驶方向。现在我有这个工作代码可以在 GDI+ 表面上绘制图像。
int hdc = Display.hDC;
IntPtr p = new IntPtr(hdc);
graphics = Graphics.FromHdc(p);
newImage = Image.FromFile(carImage);
System.Drawing.Point ulCorner = new System.Drawing.Point(x - 25, y -15);
//graphics.RotateTransform(45); //tried this line, when i used it, it drew nothing.
graphics.DrawImage(newImage, ulCorner);
如何旋转X度?
I need to rotate my image of a car X degrees to indicate the direction of travel. Right now I have this working code to draw the image on a GDI+ surface.
int hdc = Display.hDC;
IntPtr p = new IntPtr(hdc);
graphics = Graphics.FromHdc(p);
newImage = Image.FromFile(carImage);
System.Drawing.Point ulCorner = new System.Drawing.Point(x - 25, y -15);
//graphics.RotateTransform(45); //tried this line, when i used it, it drew nothing.
graphics.DrawImage(newImage, ulCorner);
how to rotate X degrees?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是旋转图像的方法
Here's how to rotate an image