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. 【渗透测试学习平台】 web for pentester -4.XML

    example1: http://192.168.91.139/xml/example1.php?xml=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%2 ...

  2. VoxelGrid体素滤波器对点云进行下采样

    使用体素化网格方法实现下采样,即减少点的数量,减少点云数据,并同时保持点云的形状特征,在提高配准.曲面重建.形状识别等算法速度中非常实用. PCL实现的VoxelGrid类通过输入的点云数据创建一个三 ...

  3. javascript获取iframe框架中页面document对象,获取子页面里面的内容,iframe获取父页面的元素,

    javascript获取iframe框架中,加载的页面document对象 因为浏览器安全限制,对跨域访问的页面,其document对象无法读取.设置属性 function getDocument(i ...

  4. [转]Could not load file or assembly 'System.Core, Version=2.0.5.0 和autofac冲突的问题

    Could not load file or assembly 'System.Core, Version=2.0.5.0 和autofac冲突的问题 来源:http://www.cnblogs.co ...

  5. 在word里插入图片,并设置图片的格式

    由于公司业务需要,需要在生成的word里插入图片(公司印章),仔细想了下,还是在word模板里添加一个书签,然后再该书签的位置插入图片,并设置图片的格式方便些: 代码如下: using System; ...

  6. WPF外包公司——北京动点飞扬软件:开发企业WPF项目需要掌握些什么

    做为企业开发一个WPF项目,对于很多不熟悉微软WPF技术和XAML语言开发团队而言,北京动点飞扬在此给各位一点建议: 1.首先开发团队要整体对于XAML和WPF的运作机制熟悉. 2.开发人员起码要会用 ...

  7. SSH登陆 Write failed: Broken pipe解决办法

    新装的一台linux 6.4主机在所有参数调优以后,运行起来要跑的程序后.再通过su - www时,提示如下: su: cannot set user id: Resource temporarily ...

  8. context menu与submenu区别

    http://blog.csdn.net/liuxiit/article/details/6819235 总结调用顺序: 点击“Menu" 键时,调用 onCreateOptionsMenu ...

  9. [Git].gitignore失效的原因

    使用git管理源代码已经成为现在开源社区的一大选择. 开发的人都知道,在源代码管理中,我们需要监控和备份的是代码,而不是开发过程中生成的exe和dll文件.//即使在某些时候,我们需要某些dll,我们 ...

  10. ubuntu 12.04 设置代理

    一. Ubuntu 12.04 apt-get 代理设置 由于公司通过代理上网,firefox的代理设置很容易就搞定了,但是通过apt-get安装软件还是不行,于是,查阅了很多资料,最多的方法就是网上 ...