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. request.getParameterMap()使用方法

    我习惯于加密完 重定向 : Map<String,String[]> getMap = request.getParameterMap(); String[] a = getMap.get ...

  2. android之LayoutInflater讲解

    在实际工作中,事先写好的布局文件往往不能满足我们的需求,有时会根据情况在代码中自定义控件,这就需要用到LayoutInflater-->用来获得布局文件对象的. LayouInflater经常在 ...

  3. poj3461 字符串匹配 熟悉kmp算法第一题

     题意:  计算一个字符串在另一个字符串中出现的次数. #include<cstdio> #include<cstring> #include<algorithm> ...

  4. Generator 函数学习笔记

    // 使用 function* 定义一个 generator 函数 function* helloWorldGenerator() { yield 'hello'; // yield 关键字作为暂停的 ...

  5. Qt 手动添加ui文件到工程(转)

    制作ui文件 先应该用Qt Designer绘制一个自己的界面,并存为myform.ui(这里的myform可以用自己喜欢的名字代替).在制作自己的界面文件时要注意以下几个要点: 1.要记住ui文件的 ...

  6. 论文笔记之:Deep Attention Recurrent Q-Network

    Deep Attention Recurrent Q-Network 5vision groups  摘要:本文将 DQN 引入了 Attention 机制,使得学习更具有方向性和指导性.(前段时间做 ...

  7. The Run-Time Constant Pool The Constant Pool

    http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.4 http://docs.oracle.com/javase ...

  8. 使用as3控制动画的播放与暂停

    1.需要两个按钮元件 2.在属性面板为两个按钮元件分别命名为pausebutton与playButton 3.代码 stop(); pausebutton.visible = false; playB ...

  9. Android Hotpatch系列之-给release包打Patch

    在默认debug包里面,是不对class做混淆的,所以Patch编写相对简单,但是应用在发布的时候都是release包,会对代码做混淆,此时class name ,field name,method ...

  10. input:-webkit-autofill 导致chrome的输入框背景颜色变成黄色

    填写form表单时发现chrome的一个好坑啊! 当你之前有填写过表单,获取焦点时,input会有一个记录之前填写过的文本的下拉列表式的东东,就像这样:(抱歉丑了点,隐私问题打上了马赛克) 按理说,这 ...