- 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
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- int width = 200;
- int height = 100;
- int x = 50;
- int y = 20;
- private void Form1_Paint(object sender, PaintEventArgs e)
- {
- Graphics g = e.Graphics;
- Pen pen = new Pen(Color.Gray);
- Rectangle rect = new Rectangle(x, y, width, height);
- //绘制椭圆柱体
- for (int i = y; i < y+50; i++)
- {
- Rectangle rectTemp = new Rectangle(x, i, width, height);
- g.DrawEllipse(pen, rectTemp);
- }
- //填充扇形
- SolidBrush brush = new SolidBrush(Color.Gainsboro);
- g.FillPie(brush,rect,0,360);
- brush = new SolidBrush(Color.Red);
- g.FillPie(brush,rect,60,150);
- brush = new SolidBrush(Color.Yellow);
- g.FillPie(brush,rect,210,150);
- g.Dispose();
- }
- }
- }
C#编程-135:Graphics绘制三维饼状图
原创
©著作权归作者所有:来自51CTO博客作者彭世瑜的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Java给整个PDF文件设置中文水印
——年金波老师上课笔记 Core Java课程笔记1 1 编译执行java文件 1 生成Javadoc:标准的注释文档(html) 1 java内存模型 1 java运行环境的搭建
Java给整个PDF文件设置中文水印 java 测试 数据结构与算法 System