加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

C#编程-135:Graphics绘制三维饼状图

(2017-08-20 16:29:13)
标签:

csharp

分类: 科技

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace Draw3DPie
  11. {
  12.     public partial class Form1 Form
  13.     {
  14.         public Form1()
  15.         {
  16.             InitializeComponent();
  17.         }
  18.         int width 200;
  19.         int height 100;
  20.         int 50;
  21.         int 20;
  22.         private void Form1_Paint(object sender, PaintEventArgs e)
  23.         {
  24.             Graphics e.Graphics;
  25.             Pen pen new Pen(Color.Gray);
  26.             Rectangle rect new Rectangle(x, y, width, height);
  27.              
  28.             //绘制椭圆柱体
  29.             for (int y; y+50; i++)
  30.             {
  31.                 Rectangle rectTemp new Rectangle(x, i, width, height);
  32.                 g.DrawEllipse(pen, rectTemp);
  33.             }
  34.             //填充扇形
  35.             SolidBrush brush new SolidBrush(Color.Gainsboro);
  36.             g.FillPie(brush,rect,0,360);
  37.             brush new SolidBrush(Color.Red);
  38.             g.FillPie(brush,rect,60,150);
  39.             brush new SolidBrush(Color.Yellow);
  40.             g.FillPie(brush,rect,210,150);
  41.             g.Dispose();
  42.         }
  43.     }
  44. }

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有