コード例 #1
0
ファイル: PieChartControl.cs プロジェクト: henrikja/EVEMon
        /// <summary>
        /// Sets values for the chart and draws them.
        /// </summary>
        /// <param name="graphics">Graphics object used for drawing.</param>
        private void DoDraw(Graphics graphics)
        {
            if (m_drawValues == null || m_drawValues.Length <= 0)
            {
                return;
            }

            graphics.SmoothingMode = SmoothingMode.AntiAlias;
            float width  = ClientSize.Width - m_leftMargin - m_rightMargin;
            float height = ClientSize.Height - m_topMargin - m_bottomMargin;

            // If the width or height if <=0 an exception would be thrown -> exit method..
            if (width <= 0 || height <= 0)
            {
                return;
            }

            PieChart?.Dispose();

            if (m_drawColors != null && m_drawColors.Length > 0)
            {
                PieChart = new PieChart3D(m_leftMargin, m_topMargin, width, height, m_drawValues, m_drawColors,
                                          m_sliceRelativeHeight, m_drawTexts);
            }
            else
            {
                PieChart = new PieChart3D(m_leftMargin, m_topMargin, width, height, m_drawValues, m_sliceRelativeHeight,
                                          m_drawTexts);
            }

            PieChart.FitToBoundingRectangle(m_fitChart);
            PieChart.InitialAngle(m_initialAngle);
            PieChart.SliceRelativeDisplacements(m_drawRelativeSliceDisplacements);
            PieChart.ColorTypeOfEdge(m_edgeColorType);
            PieChart.EdgeLineWidth(m_edgeLineWidth);
            PieChart.StyleOfShadow(m_shadowStyle);
            PieChart.HighlightedIndex(m_highlightedIndex);
            PieChart.Draw(graphics);
            PieChart.Font(Font);
            PieChart.ForeColor(ForeColor);
            PieChart.PlaceTexts(graphics);
        }