C#.net GDI作曲线图

从MDB文件中读取数据做曲线图

 public void initGDI()
        {
            //画图初始化
            Bitmap bmap = new Bitmap(pcWendu.Width, pcWendu.Height);
            Graphics gph = Graphics.FromImage(bmap);
            gph.Clear(Color.White);

            PointF cpt = new PointF(40,390);//中心点
            PointF[] xpt = new PointF[3] { new PointF(pcWendu.Width, cpt.Y), new PointF(pcWendu.Width - 15, cpt.Y - 8), new PointF(pcWendu.Width - 15, cpt.Y + 8) };//x轴三角形
            PointF[] ypt = new PointF[3] { new PointF(cpt.X, cpt.X - 25), new PointF(cpt.X - 8, cpt.X - 10), new PointF(cpt.X + 8, cpt.X - 10) };//y轴三角形
            //画x轴
            gph.DrawLine(Pens.Black, cpt.X, cpt.Y, pcWendu.Width - 10, cpt.Y);
            gph.DrawPolygon(Pens.Black, xpt);
            gph.FillPolygon(new SolidBrush(Color.Black), xpt);
            gph.DrawString("时间", new Font("宋体", 10), Brushes.Black, new PointF(pcWendu.Width - 35, cpt.Y + 10));
            //画y轴
            gph.DrawLine(Pens.Black, cpt.X, cpt.Y, cpt.X, cpt.X - 10);
            gph.DrawPolygon(Pens.Black, ypt);
            gph.FillPolygon(new SolidBrush(Color.Black), ypt);
            IOValue("0", cBSelect.Text, out string KuBunn);
            gph.DrawString(KuBunn, new Font("宋体", 10), Brushes.Black, new PointF(0, 7));

            //画x轴坐标
            float[] LactionZhD = new float[24]; //00:00
            float[] LactionBD = new float[24]; //30:00
            for (int i = 0; i < 24; i++)
            {
                gph.DrawString((i + 1).ToString("00") + ":00", new Font("宋体", 8, FontStyle.Bold), Brushes.Black, new PointF(cpt.X + i * 46 + 18, cpt.Y + 20));
                gph.DrawLine(Pens.Gray, cpt.X + i * 46 + 37, cpt.Y, cpt.X + i * 46 + 37, cpt.X);
               

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值