Graphics.RotateTransform不起作用 [英] Graphics.RotateTransform not working

查看:131
本文介绍了Graphics.RotateTransform不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



 位图img =(位图)Properties.Resources.myBitmap 。克隆(); 
图形g = Graphics.FromImage(img);
g.RotateTransform(45);
pictureBox1.Image = img;

显示图片,但不会旋转。



尝试使用 g.DrawImage(...) 请看这里来显示图片,而不是

I'm not sure why it's not working...

    Bitmap img = (Bitmap)Properties.Resources.myBitmap.Clone();
    Graphics g = Graphics.FromImage(img);
    g.RotateTransform(45);
    pictureBox1.Image = img;

The image is displayed, but it is not rotated.

解决方案

You are rotating the graphics interface, but not using it to draw the image. The picturebox control is quite simple, and may not be your friend here.

Try using g.DrawImage(...) see here to display the image instead

这篇关于Graphics.RotateTransform不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆