C# DrawString往一張圖片寫入文字的時候,出現了“引數無效”的錯誤
阿新 • • 發佈:2019-02-19
public void ProcessRequest(HttpContext context) { Bitmap nbitmap = new Bitmap(1000, 1000); Graphics g = Graphics.FromImage(nbitmap); Font font = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Italic); Brush brush = Brushes.Black; g.DrawString("測試字串", font, brush, 10, 10);/////執行到這句報引數無效 g.Dispose(); font.Dispose(); brush.Dispose(); nbitmap.Save(context.Server.MapPath("~/upload/cert" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".jpg")); nbitmap.Dispose(); }