System.Drawing.PieChart.PieChart3D.PlaceTexts C# (CSharp) Method

PlaceTexts() public method

Draws strings by individual slices. Position of the text is calculated by overridable GetTextPosition method of the PieSlice type.
public PlaceTexts ( Graphics graphics ) : void
graphics System.Drawing.Graphics /// Graphics object. ///
return void
        public virtual void PlaceTexts(Graphics graphics)
        {
            Debug.Assert(graphics != null);
            Debug.Assert(m_font != null);
            Debug.Assert(m_foreColor != Color.Empty);
            StringFormat drawFormat = new StringFormat();
            drawFormat.Alignment = StringAlignment.Center;
            drawFormat.LineAlignment = StringAlignment.Center;
            Brush fontBrush = new SolidBrush(m_foreColor);
            foreach (PieSlice slice in m_pieSlices) {
                if (slice.Text != null && slice.Text.Length > 0) {
                    PointF point = slice.GetTextPosition();
                    graphics.DrawString(slice.Text, m_font, fontBrush, point, drawFormat);
                }
            }
            fontBrush.Dispose();
        }