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

首頁 > 編程 > .NET > 正文

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

2024-07-10 13:06:44
字體:
來源:轉載
供稿:網友

 

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
{
///
/// graph 的摘要說明。
///
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);
}

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

 

 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 开远市| 顺昌县| 祁东县| 金寨县| 七台河市| 武宁县| 邯郸市| 寻甸| 巩义市| 宁强县| 云霄县| 庐江县| 焦作市| 明溪县| 盈江县| 巫溪县| 仁寿县| 清徐县| 墨竹工卡县| 岳池县| 瑞安市| 和顺县| 黔东| 宝应县| 阳东县| 普宁市| 尉犁县| 沧州市| 永新县| 黑河市| 邵东县| 许昌县| 渭南市| 天峻县| 清流县| 浑源县| 壤塘县| 德安县| 北流市| 博湖县| 荆门市|