startAngle
类型:System..::.Single
从 x 轴到弧线的起始点沿顺时针方向度量的角(以度为单位)。msdn的解释是上面这个,但是这话没怎么看明白,起始点是哪个点,角度又怎么看呢

解决方案 »

  1.   

    startAngle:从x轴沿顺时针方向旋转到扇形区第一个边所测得的角度(以度为单位)。
    sweepAngle:从startAngle参数沿顺时针方向旋转到扇形区第二个边所测得的角度(以度为单位)。他们2个之间存在关系的我给你贴点代码你看下
    DataSet dsOptions = Helper.ExecuteDataSet("select * from [voteOption] where [parentId] = " + id);
            //选项总数
            int TotalOptions = dsOptions.Tables[0].Rows.Count;        string[] OptionArray = new string[TotalOptions];
            string[] ColorArray = new string[TotalOptions];
            int[] BallotArray = new int[TotalOptions];        int TotalBallots = 0;        for (int i = 0; i < TotalOptions; i++)
            {
                OptionArray[i] = dsOptions.Tables[0].Rows[i]["option"].ToString();
                ColorArray[i] = dsOptions.Tables[0].Rows[i]["color"].ToString();
                BallotArray[i] = int.Parse(dsOptions.Tables[0].Rows[i]["ballots"].ToString());
                TotalBallots += BallotArray[i];
            }
            dsOptions.Dispose();        int width = 400, hight = 300;
            Bitmap image = new Bitmap(width, hight);
            Graphics g = Graphics.FromImage(image);  //创建画布
            g.Clear(Color.YellowGreen);   //清空背景色
            Pen pen1 = new Pen(Color.Red);
            Font font1 = new Font("宋体", 12);   //设置字体类型和大小
            Brush brush = new SolidBrush(Color.Blue);  //设置画刷颜色
            Pen pen = new Pen(Color.Blue, 1);  //创建画笔对象
            g.DrawString("GDI+绘制圆形", font1, brush, 80, 20);
            float StartAng = 0;
            float CurrentAng = 0;
            for (int i = 0; i < BallotArray.Length; i++)
            {
                float percent = (TotalBallots == 0) ? 0.0F : (float)((float)BallotArray[i] / (float)TotalBallots);
                CurrentAng = percent * 360;            
                g.FillPie(new SolidBrush(GetColor(ColorArray[i])), 10, 80, 80, 80, StartAng, CurrentAng);
                StartAng += CurrentAng;
            }
            g.DrawRectangle(pen1, 50, 300, 300, 100);  //绘制范围框
            g.FillRectangle(new SolidBrush(Color.Red), 4, 220, 20, 10);
            g.FillRectangle(new SolidBrush(Color.Blue), 4, 240, 20, 10);        System.IO.MemoryStream ms = new System.IO.MemoryStream();
            image.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
            Response.ClearContent();
            Response.ContentType = "image/Gif";
            Response.BinaryWrite(ms.ToArray());
      

  2.   

    能传我邮箱不   [email protected]
    谢谢