c#使用GDI+简单绘图(二)
// 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+简单绘图(二)的更多相关文章
- c#使用GDI+简单绘图
private void button2_Click(object sender, EventArgs e) { Bitmap image = new Bitmap(200, 200); Graphi ...
- C# GDI+简单绘图
一.使用Pen画笔 Pen的主要属性有: Color(颜色),DashCap(短划线终点形状),DashStyle(虚线样式),EndCap(线尾形状), StartCap(线头形状),Width(粗 ...
- 使用C语言实现二维,三维绘图算法(3)-简单的二维分形
使用C语言实现二维,三维绘图算法(3)-简单的二维分形 ---- 引言---- 每次使用OpenGL或DirectX写三维程序的时候, 都有一种隔靴搔痒的感觉, 对于内部的三维算法的实现不甚了解. 其 ...
- iOS开发UI篇—Quartz2D简单使用(二)
iOS开发UI篇—Quartz2D简单使用(二) 一.画文字 代码: // // YYtextview.m // 04-写文字 // // Created by 孔医己 on 14-6-10. // ...
- 2019-04-15 Python之利用matplotlib和numpy的简单绘图
环境:win10家庭版, Anocada的 Spyder 一.简单使用 使用函数 plt.polt(x,y,label,color,width) 根据x,y 数组 绘制直,曲线 import nump ...
- VC6下OpenGL 开发环境的构建外加一个简单的二维网络棋盘绘制示例
一.安装GLUT 工具包 GLUT 不是OpenGL 所必须的,但它会给我们的学习带来一定的方便,推荐安装. Windows 环境下的GLUT 本地下载地址:glut-install.zip(大小约为 ...
- 【sql注入】简单实现二次注入
[sql注入]简单实现二次注入 本文转自:i春秋社区 测试代码1:内容详情页面 [PHP] 纯文本查看 复制代码 01 02 03 04 05 06 07 08 09 10 11 12 13 14 1 ...
- Java秒杀简单设计二:数据库表和Dao层设计
Java秒杀简单设计二:数据库表Dao层设计 上一篇中搭建springboot项目环境和设计数据库表 https://www.cnblogs.com/taiguyiba/p/9791431.html ...
- 一个用于提取简体中文字符串中省,市和区并能够进行映射,检验和简单绘图的python模块
简介 一个用于提取简体中文字符串中省,市和区并能够进行映射,检验和简单绘图的python模块. 举个例子: ["徐汇区虹漕路461号58号楼5楼", "泉州市洛江区万安塘 ...
随机推荐
- Linux — 用户组、权限
Linux 用户组分为:所有者.所在组.其他组 所有者:谁创建,谁是所有者.命令:ls -al 所在组:当创建文件或者文件夹时,这个文件或者文件夹所分配到的用户组,这样就会有效地隔离文件. 其他组:和 ...
- Rehat一键安装mysql脚本和备份数据库脚本
Rehat一键安装mysql脚本 ##说明:适用,Rehat 5 6 7 1.运行状态,运行成功输出mysql临时密码 2.代码如下 #!/bin/bash #获取系统信息 sudo cat /etc ...
- socket和抓包工具wireshark
socket和抓包工具wireshark 最近在学习Python代码中的socket和抓包工具wireshark,故又将socket等概念又学习了一遍,温故而知新: Python代码如下: serve ...
- Java 多线程(四) 多线程访问成员变量与局部变量
先看一个程序例子: public class HelloThreadTest { public static void main(String[] args) { HelloThread r = ne ...
- 英语app分析
Andorid 版本 第一部分 调研, 评测 搜索了一下必应跑出来的是微软必应,在印象中微软的产品都是很可靠地.安装之后对它的 排版字体图片等不是很喜欢,感觉有道词典会更亲切一点. 必应 ...
- 集美大学网络1413第九次作业成绩(团队五) -- 测试与发布(Alpha版本)
NO.NE团队的项目链接有效,六个核桃和六指神功团队可以请教下他们,避免因IP地址无效或者因tomcat不打开就不能访问的情况,毕竟助教没办法知道此时此刻它是开着还是关闭啊啊啊... 题目 团队作业5 ...
- 201521123023《java程序设计》第三周学习总结
1. 本周学习总结 2. 书面作业 1.代码阅读 public class Test1 { private int i = 1;//这行不能修改 private static int j = 2; p ...
- Java中 == 和 equals()详解
java中的数据类型分为两种: 一 .基本数据类型: byte.short.int.long.float.double.char.boolean 比较它们需要用 == ,比较的是它们的值是否相等 ...
- Mybatis第一篇【介绍、快速入门、工作流程】
什么是MyBatis MyBatis 本是apache的一个开源项目iBatis, 2010年这个项目由apache software foundation 迁移到了google code,并且改名为 ...
- Angular JS 基础应用--第一篇
前 言 Android应用开发中,有一些功能虽然能够使用原生JS来实现,但是会比较的复杂,因此一些相应的框架应运而生了.框架相对于原生JS而言,从主观上来说,最大的改变就是代码 ...