C#利用Graphics类绘制进阶--图片旋转

public Bitmap GetImage(Bitmap bmp, float py)
{
    Bitmap bitmap;
    if(py==90 || py==270)
    {
        bitmap= new Bitmap(bmp.Height, bmp.Width);
    }
    else
    {
        bitmap= new Bitmap(bmp.Width, bmp.Height);    
    }
    Graphics g = Graphics.FromImage(bitmap);
    g.TranslateTransform(bmp.Height, 0);
    g.RotateTransform(py);
    g.DrawImage(bmp, new Point(0, 0));
    return bitmap;
}

猜你喜欢

转载自blog.csdn.net/HorseRoll/article/details/85230089
今日推荐