コード例 #1
0
        private void panel1_Paint(object sender, PaintEventArgs es)
        {
            //DrawArcRectangle(es);
            Graphics graph = es.Graphics;

            graph.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
            Pen       pen  = new Pen(Color.DarkRed, 30);
            Rectangle rect = new Rectangle(PointToScreen(panel1.Location).X, panel1.Location.Y, panel1.Width - 50, panel1.Height - 50);

            foreach (GraphValue value in graphValues)
            {
                sweepAngle = value.getValue() / total * 360;
                rect.X     = (panel1.Width - rect.Width) / 2;
                rect.Y     = (panel1.Height - rect.Height) / 2;
                pen.Color  = value.getColor();
                pen.Color  = value.getColor();
                graph.DrawArc(pen, rect, (float)startAngle, (float)sweepAngle);
                startAngle = sweepAngle - 90;

                // pen.Color.
            }

            try
            {
                percentLabel.Text     = (int)((graphValues.First().getValue() / total) * 100) + "%";
                descriptionLabel.Text = description.getTitle();
            }

            catch
            {
            }
        }