c#使用GDI+简单绘图(二)
来源:互联网 发布:隐适美 时代天使 知乎 编辑:程序博客网 时间:2024/04/25 19:53
// 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, 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, 0, 0, 450, 100); // Add an ellipse. g.FillEllipse(Brushes.PaleGoldenrod, 120, 13, 300, 50); g.DrawEllipse(Pens.Green, 120, 13, 299, 49); // Draw some text using a fancy font. Font font = new Font("Harrington", 20, FontStyle.Bold); g.DrawString("Oranges are tasty!", font, 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, 0); // Render the image to the output stream. image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg); // Clean up. g.Dispose(); image.Dispose();
0 0
- c#使用GDI+简单绘图(二)
- C# GDI+简单绘图二
- c#使用GDI+简单绘图
- c# GDI+简单绘图(二)
- c# GDI+简单绘图(二)
- c# GDI+简单绘图(二)
- c# GDI+简单绘图(二)
- c# GDI+简单绘图(二)
- c# GDI+简单绘图(二)
- c# GDI+简单绘图(二)
- c# GDI+简单绘图(二)
- c# GDI+简单绘图(二)
- c# GDI+简单绘图(二)
- c# GDI+简单绘图(二)
- c# GDI+简单绘图
- c# GDI+简单绘图
- c# GDI+简单绘图
- c# GDI+简单绘图
- hdu-1250-Hat's Fibonacci(大数问题)
- linux查看CPU性能及工作状态的指令mpstat,vmstat,iostat,sar,top
- 在Eclipse中反编译Class文件完全详解
- Flex 最全的换行,制表符,回车,空格......特殊符号
- Android任务和返回栈完全解析,细数那些你所不知道的细节
- c#使用GDI+简单绘图(二)
- 降低IO操作的利器/dev/shm
- 程序员如何做到『编程速度又快,Bug 数量又少』?
- Kinect应用开发实战 准备篇&原理篇
- shell script多种运行方式
- 看数据结构写代码(32) 赫夫曼树编码以及译码
- malloc与calloc
- Java结合Groovy让程序支持动态算法
- eclipse中窗体/活动标签的title出现乱码