图片旋转90度:(转)Graphics.TranslateTransform string filePath =@"C:\a.jpg"; using (Bitmap bm = new Bitmap(500,500)) { using (Graphics g = Graphics.FromImage(bm)) { g.Clear(Color.Wheat); g.TranslateTransform(0, 0, MatrixOrder.Prepend); g.RotateTransform(45); FontFamily ff = new FontFamily("宋体"); Font f =new Font(ff,10); Brush b = new SolidBrush(Color.Black); StringFormat sf = new StringFormat(); g.DrawString("", f, b, new PointF(10, 10), sf); g.DrawString("", f, b, new PointF(10, 10 + 30 + 10), sf); } bm.Save(filePath, ImageFormat.Jpeg); }
只在ie里可用
string filePath =@"C:\a.jpg";
using (Bitmap bm = new Bitmap(500,500))
{
using (Graphics g = Graphics.FromImage(bm))
{
g.Clear(Color.Wheat);
g.TranslateTransform(0, 0, MatrixOrder.Prepend);
g.RotateTransform(45);
FontFamily ff = new FontFamily("宋体");
Font f =new Font(ff,10);
Brush b = new SolidBrush(Color.Black);
StringFormat sf = new StringFormat();
g.DrawString("", f, b, new PointF(10, 10), sf);
g.DrawString("", f, b, new PointF(10, 10 + 30 + 10), sf);
}
bm.Save(filePath, ImageFormat.Jpeg);
}