using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Drawing.Drawing2D; public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Bitmap bitmap = new Bitmap(, );
Graphics graphics = Graphics.FromImage(bitmap);
graphics.Clear(Color.White);
Point centerPoint = new Point(, );
int r = ;
GraphicsPath path = new GraphicsPath();
path.AddEllipse(centerPoint.X - r, centerPoint.Y - r, * r, * r);
PathGradientBrush mypathgradientBrush = new PathGradientBrush(path);
mypathgradientBrush.CenterPoint = centerPoint;
mypathgradientBrush.CenterColor = Color.DarkGreen;
mypathgradientBrush.SurroundColors = new Color[] { Color.Gold };
graphics.FillEllipse(mypathgradientBrush, centerPoint.X - r, centerPoint.Y - r, * r, * r);
centerPoint = new Point(, );
r = ;
path = new GraphicsPath();
path.AddEllipse(centerPoint.X - r, centerPoint.Y - r, * r, * r);
path.AddEllipse(centerPoint.X - *r, centerPoint.Y - *r, * r, * r);
path.AddEllipse(centerPoint.X - * r, centerPoint.Y - * r, * r, * r);
mypathgradientBrush = new PathGradientBrush(path);
mypathgradientBrush.CenterPoint = centerPoint;
mypathgradientBrush.CenterColor = Color.Gold;
mypathgradientBrush.SurroundColors = new Color[] { Color.Black, Color.Blue, Color.DarkGreen };
graphics.FillPath(mypathgradientBrush, path);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
Response.ClearContent();
Response.ContentType = "image/Jpeg";
Response.BinaryWrite(ms.ToArray());
}
}

asp.net GDI+ 使用PathGradienBrush类实现彩色渐变的更多相关文章

  1. ASP.NET 的IP帮助类

    个人网站地址: https://www.lesg.cn/netdaima/net/2016-239.html ASP.NET 的IP帮助类 在Web开发中会出现需要调用客户IP的方法: 一般调用方法就 ...

  2. 一点ASP.NET MVC Html.Helper类的方法

    一点ASP.NET MVC Html.Helper类 这里就只写一个Html.ActionLink()和Html.DropdownList(). Html.ActionLink()里有三个参数,第一个 ...

  3. ASP无惧上传类不能上传中文双引号文件及ASP函数InStr存在bug

    ASP无惧上传类不能上传中文双引号文件及ASP函数InStr存在bug 近日发现eWebEditor V2.8 asp 版本上传文件文件名不能包含中文双引号,发现eWebEditor使用ASP“无惧上 ...

  4. 在ASP.NET Core的startup类中如何使用MemoryCache

    问: 下面的代码,在ASP.NET Core的startup类中创建了一个MemoryCache并且存储了三个键值“entryA”,“entryB”,“entryC”,之后想在Controller中再 ...

  5. 【转载】Asp.Net生成图片验证码工具类

    在Asp.Net应用程序中,很多时候登陆页面以及其他安全重要操作的页面需要输入验证码,本文提供一个生成验证码图片的工具类,该工具类通过随机数生成验证码文本后,再通过C#中的图片处理类位图类,字体类,一 ...

  6. asp.net mvc自定义JsonResult类来防止MaxJsonLength超过限制

    前不久在做一个项目的时候,我用到了mvc的webapi返回了一个大数据,结果报了500错误,如下图所示: Server Error in ‘/’ Application. Error during s ...

  7. asp.net(C#) Excel导出类 导出.xls文件

    ---恢复内容开始--- using Microsoft.Office.Interop.Excel; 针对office 2003需添加引用Microsoft   Excel   11.0   Obje ...

  8. C# :GDI+技术生成复杂型彩色验证码(转载)

    该类是生成一个验证码的类,集合了网上大部分的C#关于GDI+的文章进行多次改进,现在已经形成了可在生产环节中使用的验证码. 该验证码加入了背景噪点,背景噪点曲线和直线,背景噪点文字以及扭曲,调暗,模糊 ...

  9. ASP.NET HttpRuntime.Cache缓存类使用总结

    1.高性能文件缓存key-value存储—Redis 2.高性能文件缓存key-value存储—Memcached 备注:三篇博文结合阅读,简单理解并且使用,如果想深入学习,请多参考文章中给出的博文地 ...

随机推荐

  1. 一些相关的github

    https://github.com/LTS4/DeepFool 貌似是说可以愚弄深度神经网络? https://github.com/tflearn/tflearn TF学习指南 http://gi ...

  2. python中的if __name__ == '__main__' what hell is it?

    python中的if __name__ == '__main__' what hell is it? python认为一切模块都可能被执行或者被import 如果一个模块是被import导入的,那么该 ...

  3. 【转载】ansys中压力随时间变化的表格加载方法

    原文地址:http://wenku.baidu.com/link?url=w9k94Upqbok0SUNU3L7LOLRDLUtP7W_KyQWK68ajK_nEbO00mO6hzbuBQ01rS07 ...

  4. github 如何合并不同分支

    From: http://stackoverflow.com/questions/1123344/merging-between-forks-in-github 1. 添加remote origina ...

  5. IE中Keep-Alive机制引起的错误

    我们知道Http协议是基于TCP/IP连接的,也就是说客户端浏览器向服务器发出一个Http请求并得到响应是要建立一条TCP/IP连接的,但是如果每发出一个Http请求客户端就要向服务器端建立一条TCP ...

  6. libvirt

    http://libvirt.org/index.html libvirt supports: The KVM/QEMU Linux hypervisor The Xen hypervisor on ...

  7. MapReduce简介

    MapReduce简介 参考自[http://www.cnblogs.com/swanspouse/p/5130136.html] MapReduce定义: MapReduce是一种可用于数据处理的编 ...

  8. Sqlserver推荐参数配置及日志收缩问题

    最近不定期有项目反馈周期性的系统整体性能下降情况,经分析存在因数据库环境.参数配置不佳造成的.比如,sqlserver日志文件缺省按百分比增长,当日志文件已经比较大时,每次扩展时耗时较长,系统整体卡顿 ...

  9. UDP发送数据测试

    一个合作伙伴说UDP发送数据,A(IP:192.168.1.100 子网掩码255.255.255.0)网段能发数据到B网段,但B(IP:192.168.2.100 子网掩码255.255.255.0 ...

  10. Android String操作

    android String.valueOf(ch).getBytes("GBK") --------------------------------------------- S ...