// 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. 第1阶段——uboot分析之查找命令run_command函数和命令定义过程(6)

    本节主要学习,run_command函数命令查找过程,命令生成过程 1.run_command函数命令查找过程分析:在u-boot界面中(main_loop();位于u-boot-1.1.6/comm ...

  2. Rational Rose2013安装及破解教程

    1.下载地址:http://pan.baidu.com/s/1mhKGfHY 2.安装:解压缩文件"[Rational.Rose.Enterprise.Edition.2003].Softw ...

  3. 结对编程1——四则运算-GUI

    码市链接:https://coding.net/u/hmhhh/p/hmh-homework/git/tree/master/ 201421123003 黄建英 201421123004 黄美海 题目 ...

  4. 【Beta阶段】第五次scrum meeting

    Coding/OSChina 地址 1. 会议内容 学号 主要负责的方向 昨日任务 昨日任务完成进度 接下去要做 99 PM 查阅换肤功能相关资料 100% 着手联网功能 100 DEV 完成分享邀请 ...

  5. 第二次项目冲刺(Beta阶段)--第二天

    一.站立式会议照片 二.项目燃尽图 三.项目进展 功能模块的代码编写完成,界面布局规划已经定型,不会有大的修改,接下去就是主要解决存在的bug以及各种测试. 队员  ID 贡献比 王若凡 201421 ...

  6. Swing-JTable用法-入门

    注:本文为学习笔记,原文为How to Use Tables,本文所有素材与代码均源于原文,可能会有部分更改. JTable是Swing中的表格控件,它的外观如下所示: 没错,excel或者acces ...

  7. [10] 过滤器 Filter

    1.过滤器的基本概念和作用 在网站的页面访问时,我们往往需要做一些控制,如普通用户无法访问VIP用户的页面.如果在每一个需要访问控制的文件中都加上判断代码,那么代码将会很冗余,一旦需要统一修改时也极其 ...

  8. 利用Struts拦截器限制上传图片的格式和大小

    在这之前 Struts的一个核心功能就是大量的拦截器,既然是框架,那么自然也就贴心地为我们准备好了各种常用的功能,比如这里即将讨论的如何限制上传图片的格式和大小.那么既然是使用Struts已经写好的拦 ...

  9. 代码的鲁棒性:链表中倒数第k个结点

    输入一个链表,输出该链表中倒数第k个结点. 代码思路如下:两个指针,先让第一个指针和第二个指针都指向头结点,然后再让第一个指正走(k-1)步,到达第k个节点.然后两个指针同时往后移动,当第一个结点到达 ...

  10. java面试之Hashmap

    在java面试中hashMap应该说一个必考的题目,而且HashMap 和 HashSet 是 Java Collection Framework 的两个重要成员,其中 HashMap 是 Map 接 ...