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. hdu4671 Backup Plan ——构造题

    link:http://acm.hdu.edu.cn/showproblem.php?pid=4671 其实是不难的那种构造题,先排第一列,第二列从后往前选. #include <iostrea ...

  2. Extjs控制面板组件

    (1)aoolyTo:(id) renderTo:(id)呈现在哪个html里面,同上  id最好用"" contentEI:() 呈现哪个html元素里面,把eI内的内容呈现 ( ...

  3. JavaScript学习中的挑战

    当人们尝试学习 JavaScript , 或者其他编程技术的时候,常常会遇到同样的挑战: 有些概念容易混淆,特别是当你学习过其他语言的时候.很难找到学习的时间(有时候是动力).一旦当你理解了一些东西的 ...

  4. dk.internal.org.objectweb.asm.Opcodes.IF_ACMPNE

    http://cr.openjdk.java.net/~hannesw/8008351/webrev/src/jdk/nashorn/internal/codegen/Condition.java.s ...

  5. There is already an open DataReader associated with this Command which must be closed first." exception in Entity Framework

    Fixing the "There is already an open DataReader associated with this Command which must be clos ...

  6. Android性能之启动时间篇

    背景介绍 Android用户也许会经常碰到以下的问题: 1)应用后台开着,手机很快没电了--应用耗电大: 2)首次/非首次启动应用,进入应用特别慢--应用启动慢: 3)应用使用过程中,越来越卡--CP ...

  7. 黄聪:基于jQuery+JSON的省市区三级地区联动

    查看演示:http://www.helloweba.com/demo/cityselect/ 源码下载:http://files.cnblogs.com/files/huangcong/citysel ...

  8. Android学习笔记(五)

    Intent不仅用来启动一个活动,Intent还可以在启动活动的时候传递参数. 1.向下一个活动传递数据 启动活动的时候传递数据,Intent提供了一系列putExtra()方法的重载,可以把要传递的 ...

  9. LayoutInflater.java (android-19)

    /* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Versi ...

  10. Hadoop的管理目录

    HDFS文件结构 1.NameNode的文件结构,NameNode会创建VERSION.edits.fsimage.fstime文件目录.其中dfs.name.dir属性是一个目录列表,是每个目录的镜 ...