画柱状图

 private void PaintRain(string strSTCD,Point point)
        {
            double P1 = 0;
            double P2 = 0;
            clsACCP objACCP = new clsACCP();

            DateTime TMe,TMnow;

            TMnow = System.DateTime.Now;
            TMe = Convert.ToDateTime(TMnow.Year.ToString() + "-" + TMnow.Month.ToString() + "-" + TMnow.Day.ToString() + " 08:00:00");

            P1 = objACCP.getDayP(strSTCD, TMe);
            P2 = objACCP.getACCP(strSTCD, TMe, TMnow);

            if (P1 == 0 && P2 == 0)
            {

            }
            else
            {
                double Tmep1 = 0;
                if (P1 > P2)
                {
                    Tmep1 = P1;
                }
                else
                {
                    Tmep1 = P2;
                }
                int RectangleW = 40;
                int RectangleH = 50;
                int RectangleX = point.X-RectangleW-3;
                int RectangleY = point.Y-RectangleH-3;

                int Yunit = 0;
                Yunit = Convert.ToInt32(RectangleH / Tmep1);

                Pen MyPen = new Pen(Color.Black, 2);
                G.DrawLine(MyPen, Convert.ToInt32(RectangleX), Convert.ToInt32(RectangleY + RectangleH), Convert.ToInt32(RectangleX + RectangleW ), Convert.ToInt32(RectangleY + RectangleH));

                myBrush = new SolidBrush(Color.Blue);
                G.FillRectangle(myBrush,  Convert.ToInt32(RectangleX),  Convert.ToInt32(RectangleY - (P1 * Yunit) + RectangleH),  Convert.ToInt32(RectangleW / 2),  Convert.ToInt32(P1 * Yunit));
                myBrush = new SolidBrush(Color.Red);
                G.FillRectangle(myBrush,  Convert.ToInt32(RectangleX + RectangleW / 2 + 1),  Convert.ToInt32(RectangleY - (P2 * Yunit) + RectangleH),  Convert.ToInt32(RectangleW / 2 - 1),  Convert.ToInt32(P2 * Yunit));

                Point objPoint = new Point();
                Font drawFont = new Font("宋体", 10);

                objPoint.X = Convert.ToInt32(RectangleX);
                objPoint.Y = Convert.ToInt32(RectangleY - (P1 * Yunit) + RectangleH - 15);
                G.DrawString(P1.ToString(), drawFont, myBrush, objPoint);

                objPoint.X = Convert.ToInt32(RectangleX + RectangleW / 2 + 1);
                objPoint.Y = Convert.ToInt32(RectangleY - (P2 * Yunit) + RectangleH - 15);
                G.DrawString(P2.ToString(), drawFont, myBrush, objPoint);
          }
        }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值