国产探花免费观看_亚洲丰满少妇自慰呻吟_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
}
}


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 绍兴市| 潼南县| 梓潼县| 洪湖市| 贺州市| 岳阳市| 九江县| 江陵县| 靖江市| 怀集县| 海晏县| 马边| 尚义县| 富川| 麦盖提县| 望奎县| 海丰县| 闵行区| 丰镇市| 微山县| 错那县| 吉安县| 宝坻区| 遵义市| 盘锦市| 揭西县| 临夏市| 五原县| 屏边| 孙吴县| 民权县| 黔西县| 平利县| 赤水市| 黄石市| 永康市| 宜城市| 彰化市| 会泽县| 丹阳市| 弋阳县|