⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmgdi.cs

📁 简单的人事管理系统,通过不断改进可以成为一个通用的管理系统
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Xml;

namespace HumanManage.EmpInfor
{
    public partial class FrmGdi : Form
    {
        private static XmlDocument MuchEmp = new XmlDocument();
        int x = 0;
        int y = 0;
        int z = 0;
        int j = 0;
        float i = 0;
        double n = 0.00;
        double m = 0.00;
        public FrmGdi()
        {
            InitializeComponent();
        }

        private void FrmGdi_Load(object sender, EventArgs e)
        {
            MuchEmp.Load("..\\..\\xmlAddEmp.xml");
            XmlNodeList Many = MuchEmp.SelectNodes("//新员工[@员工编号]");
            lblMuch.Text = "总共" + Many.Count.ToString() + "个员工";
            lblWhich.Text = frmInfoStat.Which + "统计图";
            x = Many.Count;
            int a = 100 / x;
            foreach (XmlNode How in Many)
            {
                if (frmInfoStat.Which == "性别")
                {
                    lblWhat.Text = "男";
                    lblOne.Text = "女";
                    if (How.ChildNodes[1].InnerText == "女")
                    {
                        y++;
                    }
                    j = x - y;
                    n = 100 * j / x;
                    m = 100 - n;
                    lblAll1.Text = "共" + j.ToString() + "人";
                    lblAll2.Text = "共" + y.ToString() + "人";
                    lblPercent1.Text = "占" + n.ToString() + "%";
                    lblPercent2.Text = "占" + m.ToString() + "%";
                }
                if (frmInfoStat.Which == "婚姻状况")
                {
                    lblWhat.Text = "已婚";
                    lblOne.Text = "未婚";
                    if (How.ChildNodes[5].InnerText == "未婚")
                    {
                        y++;
                    }
                    j = x - y;
                    n = 100 * j / x;
                    m = 100 - n;
                    lblAll1.Text = "共" + j.ToString() + "人";
                    lblAll2.Text = "共" + y.ToString() + "人";
                    lblPercent1.Text = "占" + n.ToString() + "%";
                    lblPercent2.Text = "占" + m.ToString() + "%";
                }
                if (frmInfoStat.Which == "政治面貌")
                {
                    lblWhat.Text = "党员";
                    lblOne.Text = "团员";
                    if (How.ChildNodes[4].InnerText == "团员")
                    {
                        y++;
                    }
                    j = x - y;
                    n = 100 * j / x;
                    m = 100 - n;
                    lblAll1.Text = "共" + j.ToString() + "人";
                    lblAll2.Text = "共" + y.ToString() + "人";
                    lblPercent1.Text = "占" + n.ToString() + "%";
                    lblPercent2.Text = "占" + m.ToString() + "%";
                }
                if (frmInfoStat.Which == "学历")
                {
                    lblWhat.Text = "本科";
                    lblOne.Text = "专科";
                    if (How.ChildNodes[8].InnerText == "大专")
                    {
                        y++;
                    }
                    j = x - y;
                    n = 100 * j / x;
                    m = 100 - n;
                    lblAll1.Text = "共" + j.ToString() + "人";
                    lblAll2.Text = "共" + y.ToString() + "人";
                    lblPercent1.Text = "占" + n.ToString() + "%";
                    lblPercent2.Text = "占" + m.ToString() + "%";
                }
                if (frmInfoStat.Which == "在职状态")
                {
                    lblWhat.Text = "在职";
                    lblOne.Text = "离职";
                    if (How.ChildNodes[26].InnerText == "离职")
                    {
                        y++;
                    }
                    j = x - y;
                    n = 100 * j / x;
                    m = 100 - n;
                    lblAll1.Text = "共" + j.ToString() + "人";
                    lblAll2.Text = "共" + y.ToString() + "人";
                    lblPercent1.Text = "占" + n.ToString() + "%";
                    lblPercent2.Text = "占" + m.ToString() + "%";
                }
                
            }
            z = 360 / x;
            i = z * y;
            
        }

        private void FrmGdi_Paint(object sender, PaintEventArgs e)
        {

            Graphics g = this.CreateGraphics();
            Rectangle rect = new Rectangle(100, 30, 300, 300);
            SolidBrush brush = new SolidBrush(Color.Red);
            g.FillPie(brush, rect, 0, i);
            SolidBrush brushBlue = new SolidBrush(Color.Blue);
            g.FillPie(brushBlue, rect, i, 360 - i);
            g.FillRectangle(brushBlue, 450, 50, 30, 20);
            g.FillRectangle(brush, 450, 150, 30, 20);
            //释放画布
            g.Dispose();


            
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -