C#编程-135:Graphics绘制三维饼状图
标签:
csharp |
分类: 科技 |
-
using
System; -
using
System.Collections.Generic; -
using
System.ComponentModel; -
using
System.Data; -
using
System.Drawing; -
using
System.Linq; -
using
System.Text; -
using
System.Windows.Forms; -
-
namespace
Draw3DPie - {
-
publicpartial class Form1 : Form -
{ -
publicForm1() -
{ -
InitializeComponent(); -
} -
intwidth = 200; -
intheight = 100; -
intx = 50; -
inty = 20; -
privatevoid Form1_Paint(object sender, PaintEventArgs e) -
{ -
Graphicsg = e.Graphics; -
Penpen new= Pen(Color.Gray); -
Rectanglerect new= Rectangle(x, y, width, height); -
-
//绘制椭圆柱体 -
for(int i = y; i < y+50; i++) -
{ -
RectanglerectTemp new= Rectangle(x, i, width, height); -
g.DrawEllipse(pen,rectTemp); -
} -
//填充扇形 -
SolidBrushbrush new= SolidBrush(Color.Gainsboro); -
g.FillPie(brush,rect,0,360); -
brush= newSolidBrush(Color.Red); -
g.FillPie(brush,rect,60,150); -
brush= newSolidBrush(Color.Yellow); -
g.FillPie(brush,rect,210,150); -
g.Dispose(); -
} -
} - }
前一篇:C#编程-134:字体颜色对话框

加载中…