c#使用GDI+简单绘图

c#使用GDI+简单绘图,第1张

概述c#使用GDI+简单绘图

下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。

内存溢出小编现在分享给大家,也给大家做个参考。

    // Create the in-memory bitmap where you will draw the image.      // This bitmap is 300 pixels wIDe and 50 pixels high.      Bitmap image = new Bitmap(300,50);            // get the graphics context      Graphics g = Graphics.FromImage(image);            // Draw a solID white rectangle.      // Start from point (1,1).      // Make it 298 pixels wIDe and 48 pixels high.      g.FillRectangle(Brushes.White,1,298,48);            // load a Font and use it to draw a string      Font Font = new Font("Impact",20,FontStyle.Regular);      g.DrawString("This is a test.",Font,Brushes.Blue,10,5);            // write the image to the output stream.      image.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Gif);            // dispose of the context and the bitmap      g.dispose();      image.dispose();  

    // Create the in-memory bitmap where you will draw the image.      // This bitmap is 450 pixels wIDe and 100 pixels high.      Bitmap image = new Bitmap(450,100);      Graphics g = Graphics.FromImage(image);            // Ensure high-quality curves.      g.SmoothingMode = SmoothingMode.AntiAlias;            // Paint the background.      g.FillRectangle(Brushes.White,450,100);            // Add an ellipse.      g.FillEllipse(Brushes.PaleGoldenrod,120,13,300,50);      g.DrawEllipse(Pens.Green,299,49);            // Draw some text using a fancy Font.      Font Font = new Font("Harrington",FontStyle.Bold);      g.DrawString("Oranges are tasty!",Brushes.DarkOrange,150,20);            // Add a graphic from a file.      System.Drawing.Image orangeImage =        System.Drawing.Image.Fromfile(Server.MapPath("oranges.gif"));      g.DrawImageUnscaled(orangeImage,0);            // Render the image to the output stream.      image.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg);            // Clean up.      g.dispose();      image.dispose();  

以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

总结

以上是内存溢出为你收集整理的c#使用GDI+简单绘图全部内容,希望文章能够帮你解决c#使用GDI+简单绘图所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/1237789.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-06
下一篇2022-06-06

发表评论

登录后才能评论

评论列表(0条)

    保存