国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

Asp.Net 使用 GDI+ 繪制3D餅圖入門篇源碼

2024-07-10 13:05:10
字體:
來源:轉載
供稿:網友
菜鳥學堂:
topn3dpie.aspx
------------------
<%@ page language="c#" codebehind="topn3dpie.aspx.cs" autoeventwireup="false" inherits="yeefly.topn3dpie" %>

topn3dpie.aspx.cs
-----------------
using system;
using system.collections;
using system.componentmodel;
using system.data;
using system.drawing;
using system.web;
using system.web.sessionstate;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.htmlcontrols;
using system.drawing.imaging;
using system.drawing.drawing2d;
using system.io;

namespace yeefly
{
/// <summary>
/// graph 的摘要說明。
/// </summary>
public class topn3dpie : system.web.ui.page
{
private void page_load(object sender, system.eventargs e)
{
response.contenttype = "image/jpeg";
const int width = 300, height = 300;
int x = 30, y = 50;

int piewidth = 120, pieheight = 40, pieshadow = 15;
int[] arrvote = {70,90,80,20,60,40};
random oran = new random();


bitmap objbitmap = new bitmap(width, height);
graphics objgraphics = graphics.fromimage(objbitmap);
objgraphics.drawrectangle(new pen(color.black),0,0,width,height);
objgraphics.fillrectangle(new solidbrush(color.white), 1, 1,width - 2, height - 2);
solidbrush objbrush = new solidbrush(color.blue);
objgraphics.smoothingmode = smoothingmode.antialias;

int icurrentpos = 0;

color[] arrcolor = {color.red,color.red,color.red,color.red,color.red,color.red};

for(int i = arrvote.length - 1 ; i >= 0; i--)
{
arrcolor[i] = color.fromargb(oran.next(255), oran.next(255), oran.next(255));
}

for(int i = arrvote.length - 1 ; i >= 0; i--)
{
objbrush.color = arrcolor[i];
for(int iloop2 = 0; iloop2 < pieshadow; iloop2++)
objgraphics.fillpie(new hatchbrush(hatchstyle.percent50,objbrush.color),x, y + iloop2, piewidth, pieheight, icurrentpos, arrvote[i]);
icurrentpos += arrvote[i];
}

icurrentpos = 0;
for(int i = arrvote.length - 1 ; i >= 0;i--)
{
objbrush.color = arrcolor[i];
objgraphics.fillpie(objbrush,x, y, piewidth, pieheight, icurrentpos, arrvote[i]);
icurrentpos += arrvote[i];
}

objbitmap.save(response.outputstream, imageformat.jpeg);
// clean up...
objgraphics.dispose();
objbitmap.dispose();
}

#region web 窗體設計器生成的代碼
override protected void oninit(eventargs e)
{
//
// codegen: 該調用是 asp.net web 窗體設計器所必需的。
//
initializecomponent();
base.oninit(e);
}

/// <summary>
/// 設計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內容。
/// </summary>
private void initializecomponent()
{
this.load += new system.eventhandler(this.page_load);
}
#endregion
}
}


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 石台县| 开鲁县| 长葛市| 鹤岗市| 濮阳市| 忻州市| 霍城县| 辰溪县| 台中县| 南宫市| 陵川县| 闵行区| 荃湾区| 平陆县| 曲阜市| 长葛市| 沁源县| 台前县| 渭源县| 云和县| 扶绥县| 舞钢市| 黑水县| 海伦市| 寿宁县| 安图县| 济宁市| 龙门县| 拜城县| 临江市| 锦州市| 溆浦县| 法库县| 平罗县| 休宁县| 宜都市| 临沧市| 马龙县| 阜平县| 当雄县| 德令哈市|