// 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();

c#使用GDI+简单绘图(二)的更多相关文章

  1. c#使用GDI+简单绘图

    private void button2_Click(object sender, EventArgs e) { Bitmap image = new Bitmap(200, 200); Graphi ...

  2. C# GDI+简单绘图

    一.使用Pen画笔 Pen的主要属性有: Color(颜色),DashCap(短划线终点形状),DashStyle(虚线样式),EndCap(线尾形状), StartCap(线头形状),Width(粗 ...

  3. 使用C语言实现二维,三维绘图算法(3)-简单的二维分形

    使用C语言实现二维,三维绘图算法(3)-简单的二维分形 ---- 引言---- 每次使用OpenGL或DirectX写三维程序的时候, 都有一种隔靴搔痒的感觉, 对于内部的三维算法的实现不甚了解. 其 ...

  4. iOS开发UI篇—Quartz2D简单使用(二)

    iOS开发UI篇—Quartz2D简单使用(二) 一.画文字 代码: // // YYtextview.m // 04-写文字 // // Created by 孔医己 on 14-6-10. // ...

  5. 2019-04-15 Python之利用matplotlib和numpy的简单绘图

    环境:win10家庭版, Anocada的 Spyder 一.简单使用 使用函数 plt.polt(x,y,label,color,width) 根据x,y 数组 绘制直,曲线 import nump ...

  6. VC6下OpenGL 开发环境的构建外加一个简单的二维网络棋盘绘制示例

    一.安装GLUT 工具包 GLUT 不是OpenGL 所必须的,但它会给我们的学习带来一定的方便,推荐安装. Windows 环境下的GLUT 本地下载地址:glut-install.zip(大小约为 ...

  7. 【sql注入】简单实现二次注入

    [sql注入]简单实现二次注入 本文转自:i春秋社区 测试代码1:内容详情页面 [PHP] 纯文本查看 复制代码 01 02 03 04 05 06 07 08 09 10 11 12 13 14 1 ...

  8. Java秒杀简单设计二:数据库表和Dao层设计

    Java秒杀简单设计二:数据库表Dao层设计 上一篇中搭建springboot项目环境和设计数据库表  https://www.cnblogs.com/taiguyiba/p/9791431.html ...

  9. 一个用于提取简体中文字符串中省,市和区并能够进行映射,检验和简单绘图的python模块

    简介 一个用于提取简体中文字符串中省,市和区并能够进行映射,检验和简单绘图的python模块. 举个例子: ["徐汇区虹漕路461号58号楼5楼", "泉州市洛江区万安塘 ...

随机推荐

  1. Error:Failed to load project configuration:xxxxxxxxxxxxxxxxxxxx cannot read file .idea/misc.xml

    你这idea不会没有配置默认jdk吧?你看看File--other settings--default project structure,看看project setting的project里面,有没 ...

  2. idea插件之——在markdown复制粘贴图片

    Markdown paste image 每次在idea的markdown中要粘贴图片的时候,要么复制链接,要么需要将软件手动上传到七牛云,本人根据了holgerbrandl/pasteimages这 ...

  3. 201521123107 《Java程序设计》第14周学习总结

    第14周-数据库 1.本周学习总结 2.书面作业 1. MySQL数据库基本操作 建立数据库,将自己的姓名.学号作为一条记录插入.(截图,需出现自己的学号.姓名) 在自己建立的数据库上执行常见SQL语 ...

  4. 201521123082 《Java程序设计》第5周学习总结

    201521123082 <Java程序设计>第5周学习总结 标签(空格分隔): java 1. 本周学习总结 1.1 尝试使用思维导图总结有关多态与接口的知识点. 1.2 可选:使用常规 ...

  5. bean的生命周期以及延迟实例化

    可以指定bean的初始化创建的时候调用的方法,以及销毁的时候调用的方法. 通过指定中的init-method和destroy-method方法指定bean的创建和销毁的时候执行类中的方法. 把lazy ...

  6. 201521123013 《Java程序设计》第8周学习总结

    1. 本章学习总结 2. 书面作业 Q1.List中指定元素的删除(题目4-1) 1.1 实验总结 while(list.contains(str)) list.remove(str); Q2.统计文 ...

  7. 201521123117 《Java程序设计》第8周学习总结

    1. 本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结集合与泛型相关内容. 2. 书面作业 1.List中指定元素的删除(题目4-1) 1.1 实验总结: 1.通过equals方法以及l ...

  8. 201521123080《Java程序设计》第6周学习总结

    1. 本周学习总结 1.1 面向对象学习暂告一段落,请使用思维导图,以封装.继承.多态为核心概念画一张思维导图,对面向对象思想进行一个总结. 注1:关键词与内容不求多,但概念之间的联系要清晰,内容覆盖 ...

  9. 201521123014 《Java程序设计》第2周学习总结

    1. 本周学习总结 (1)类Scanner 一个可以使用正则表达式来解析基本类型和字符串的简单文本扫描器. -例如以下代码使用户能够从System.in 中读取一个数: Scanner sc = ne ...

  10. 201521123067《Java程序设计》第1周学习总结

    1.本周学习总结 在本周的java学习中,我知道了java的发展历程,JDK和JRE以及JVM的区别与联系,并学习了如何安装Eclipse和搭建java的环境,编写出了第一个java程序,明白了jav ...