private void CreateImage() {           string[] month = new string[5] { "第一季度", "第二季度", "第三季度", "第四季度", "全年"};
          //  float[] d = new float[12] { 20,30,10,50,25,36,14,70,50.4F,28,31,10};
            Bitmap bMap = new Bitmap(700,700);
            Graphics gph = Graphics.FromImage(bMap);
            gph.Clear(Color.White);            PointF cpt = new PointF(40, 420);
            //X轴三角形
            PointF[] xpt = new PointF[3] { new PointF(cpt.Y+8, cpt.Y), new PointF(cpt.Y, cpt.Y - 4), new PointF(cpt.Y, cpt.Y + 4) };
            //Y轴三角形
            PointF[] ypt = new PointF[3] { new PointF(cpt.X, cpt.X - 8), new PointF(cpt.X -4, cpt.X), new PointF(cpt.X + 4, cpt.X) };
            gph.DrawString("呼叫统计图", new Font("宋体", 14), Brushes.Black, new PointF(cpt.X + 60, cpt.X));
         
            //画X轴
            gph.DrawLine(Pens.Black, cpt.X, cpt.Y, cpt.Y, cpt.Y);
            gph.DrawPolygon(Pens.Black, xpt);
            gph.FillPolygon(new SolidBrush(Color.Black), xpt);
            gph.DrawString("月份",new Font("宋体",12),Brushes.Black,new PointF(cpt.Y+10,cpt.Y+10));
            //画Y轴
            gph.DrawLine(Pens.Black, cpt.X, cpt.Y, cpt.X, cpt.X);
            gph.DrawPolygon(Pens.Black, ypt);
            gph.FillPolygon(new SolidBrush(Color.Black), ypt);
            gph.DrawString("单位(万)", new Font("宋体", 12), Brushes.Black, new PointF(0,7));
      
            for (int i = 1; i <= 12;i++ )
            {
                //画Y轴刻度
                if(i<12){
                    gph.DrawString((i*25).ToString(),new Font("宋体",11),Brushes.Black,new PointF(15,cpt.Y-i*30-6));
                    gph.DrawLine(Pens.Black,cpt.X+3,cpt.Y-i*30,cpt.X,cpt.Y-i*30);
                }
                if(i<6){
                    gph.DrawString(month[i - 1].Substring(0, 1), new Font("宋体", 11), Brushes.Black, new PointF(cpt.X + i * 30 - 5, cpt.Y + 5));
                    gph.DrawString(month[i - 1].Substring(1, 1), new Font("宋体", 11), Brushes.Black, new PointF(cpt.X + i * 30 - 5, cpt.Y + 20));
                }
                
            }
    
       
                 int[] count=new int[5];
                 DBHelper.connection.Open();
                 SqlCommand cmd = new SqlCommand("select count(*) from History", DBHelper.connection);
                 int sum =(int)cmd.ExecuteScalar();
                 DBHelper.connection.Close();
                
                 try
                 {
                     for (int n = 1; n <= 10; n = n + 3)
                     {
                         DBHelper.connection.Open();
                         string sql = string.Format("select count(*) from History where month(time) between '" + n + "'and '" + (n + 2) + "'and datediff(year, time,getdate())=0");
                         SqlDataAdapter da = new SqlDataAdapter(sql, DBHelper.connection);
                         DataSet ds = new DataSet();
                         int num = da.Fill(ds, "Histrory");
                         count[n / 3] = (int)ds.Tables[0].Rows[0][0];
                         DBHelper.connection.Close();
                     }
                     count[4] = count[0] + count[1] + count[2] + count[3];                       float x = cpt.X;
                       Font font2 = new System.Drawing.Font("Arial", 10, FontStyle.Bold);
                       Brush brush1 = new SolidBrush(Color.Red);                     for(int m=0;m<5;m++){                          x = x + 29;
                          gph.FillRectangle(brush1, x, 420 - count[m], 20, count[m] );
                          gph.DrawString(count[m].ToString(), font2, Brushes.Green, x, 420 - count[m]-15);
                     }
                     pictureBox1.Image = new Bitmap(bMap);
                 }
                 catch (Exception)
                 {
                 
                     throw;
                 }
        }
这是运行之后的图片:
C#