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

ReadjustSlices() protected method

Readjusts each slice for new bounding rectangle.
protected ReadjustSlices ( RectangleF newBoundingRectangle ) : void
newBoundingRectangle System.Drawing.RectangleF /// RectangleF representing new boundary. ///
return void
        protected void ReadjustSlices(RectangleF newBoundingRectangle)
        {
            float xResizeFactor = m_widthBoundingRect / newBoundingRectangle.Width;
            float yResizeFactor = m_heightBoundingRect / newBoundingRectangle.Height;
            float xOffset = newBoundingRectangle.X - m_xBoundingRect;
            float yOffset = newBoundingRectangle.Y - m_yBoundingRect;
            foreach (PieSlice slice in m_pieSlices) {
                float x = slice.BoundingRectangle.X - xOffset;
                float y = slice.BoundingRectangle.Y - yOffset;
                float width = slice.BoundingRectangle.Width * xResizeFactor;
                float height = slice.BoundingRectangle.Height * yResizeFactor;
                float sliceHeight = slice.SliceHeight * yResizeFactor;
                slice.Readjust(x, y, width, height, sliceHeight);
            }
        }