首页 > 其他 > 详细

GDI饼状图

时间:2019-12-04 10:56:37      阅读:76      评论:0      收藏:0      [点我收藏+]

技术分享图片

 

技术分享图片
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Drawing2D;

namespace App1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        //定义起始高度和增量
        int y = 200;
        int i;
        //侧面
        private void Button1_Click(object sender, EventArgs e)
        {
            Graphics g = this.CreateGraphics();
            Pen pen = new Pen(Color.Gray, 3);
            for (i = 0; i < 40; i++)
            {
                g.DrawEllipse(pen, 250, y - i, 150, 80);
            }
        }
        //顶部
        private void Button2_Click(object sender, EventArgs e)
        {
            Graphics g = this.CreateGraphics();
            g.FillEllipse(Brushes.White, 250, y - i, 150, 80);
        }
        //黄色
        private void Button3_Click(object sender, EventArgs e)
        {
            Graphics g = this.CreateGraphics();
            g.FillPie(Brushes.Yellow, 250, y - i, 150, 80, 0, 120);
        }
        //蓝色
        private void Button4_Click(object sender, EventArgs e)
        {
            Graphics g = this.CreateGraphics();
            g.FillPie(Brushes.Blue, 250, y - i, 150, 80, 120, 60);
        }
        //绿色
        private void Button5_Click(object sender, EventArgs e)
        {
            Graphics g = this.CreateGraphics();
            g.FillPie(Brushes.Green, 250, y - i, 150, 80, 180, 180);
        }
    }
}
App1

 

GDI饼状图

原文:https://www.cnblogs.com/Luck1996/p/11980918.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!