C# Class System.Drawing.PieChart.PieSlice

Object representing 3D pie.
Inheritance: Object, IDisposable
Mostra file Open project: Longkong/Pojjaman Class Usage Examples

Protected Properties

Property Type Description
m_boundingRectangle System.Drawing.RectangleF
m_brushEndSide System.Drawing.Brush
m_brushPeripherySurface System.Drawing.Brush
m_brushStartSide System.Drawing.Brush
m_brushSurface System.Drawing.Brush
m_brushSurfaceHighlighted System.Drawing.Brush
m_center System.Drawing.PointF
m_centerBelow System.Drawing.PointF
m_endSide System.Drawing.Quadrilateral
m_pen System.Drawing.Pen
m_pointEnd System.Drawing.PointF
m_pointEndBelow System.Drawing.PointF
m_pointStart System.Drawing.PointF
m_pointStartBelow System.Drawing.PointF
m_sliceHeight float
m_startAngle float
m_startSide System.Drawing.Quadrilateral
m_sweepAngle float

Private Properties

Property Type Description
BottomSurfaceSectionContainsPoint bool
CreatePathForCylinderSurfaceSection System.Drawing.Drawing2D.GraphicsPath
CylinderSurfaceSectionContainsPoint bool
DrawBottom void
DrawEndSide void
DrawHiddenPeriphery void
DrawSides void
DrawStartSide void
DrawTop void
DrawVisiblePeriphery void
EndSideContainsPoint bool
GetEllipseRadius double
GetFittingRectangle System.Drawing.RectangleF
GetHiddenPeripherySurfaceBounds PeripherySurfaceBounds[]
GetVisiblePeripherySurfaceBounds PeripherySurfaceBounds[]
InitializePieSlice void
InitializeSides void
InitializeSides void
PeripheryContainsPoint bool
PieSliceContainsPoint bool
PieSliceContainsPoint bool
Readjust void
Split System.Drawing.PieChart.PieSlice[]
StartSideContainsPoint bool

Public Methods

Method Description
Contains ( PointF point ) : bool

Checks if given pie slice contains given point.

Dispose ( ) : void

Disposes of all resources used by PieSlice object.

Draw ( Graphics graphics ) : void

Draws the pie slice.

GetTextPosition ( ) : PointF

Evaluates the point in the middle of the slice.

PieSlice ( Rectangle boundingRect, float sliceHeight, float startAngle, float sweepAngle, Color surfaceColor, ShadowStyle shadowStyle, EdgeColorType edgeColorType, float edgeLineWidth ) : System

Initializes a new instance of PieSlice class with given bounds and visual style.

PieSlice ( RectangleF boundingRect, float sliceHeight, float startAngle, float sweepAngle, Color surfaceColor, ShadowStyle shadowStyle, EdgeColorType edgeColorType ) : System

Initializes a new instance of PieSlice class with given bounds and visual style.

PieSlice ( float xBoundingRect, float yBoundingRect, float widthBoundingRect, float heightBoundingRect, float startAngle, float sweepAngle, Color surfaceColor ) : System

Initializes a new instance of flat PieSlice class with given bounds and visual style.

PieSlice ( float xBoundingRect, float yBoundingRect, float widthBoundingRect, float heightBoundingRect, float sliceHeight, float startAngle, float sweepAngle, Color surfaceColor, ShadowStyle shadowStyle, EdgeColorType edgeColorType ) : System

Initializes a new instance of PieSlice class with given bounds and visual style.

PieSlice ( float xBoundingRect, float yBoundingRect, float widthBoundingRect, float heightBoundingRect, float sliceHeight, float startAngle, float sweepAngle, Color surfaceColor, ShadowStyle shadowStyle, EdgeColorType edgeColorType, float edgeLineWidth ) : System

Initializes a new instance of PieSlice class with given bounds and visual style.

Protected Methods

Method Description
CreateBrushForPeriphery ( Color color ) : Brush

Creates a brush for outer periphery of the pie slice used for gradual shadow.

CreateBrushForSide ( Color color, double angle ) : Brush

Creates a brush for start and end sides of the pie slice for gradual shade.

CreateSurfaceBrushes ( Color surfaceColor, ShadowStyle shadowStyle ) : void

Creates brushes used to render the pie slice.

DisposeBrushes ( ) : void

Disposes of brush objects.

DrawCylinderSurfaceSection ( Graphics graphics, Pen pen, Brush brush, float startAngle, float endAngle, PointF pointStart, PointF pointEnd ) : void

Draws the outer periphery of the pie slice.

GetActualAngle ( float transformedAngle ) : float

Gets the actual angle from the rendering angle.

PeripheralPoint ( float xCenter, float yCenter, float semiMajor, float semiMinor, float angleDegrees ) : PointF

Calculates the point on ellipse periphery for angle.

PieSlice ( ) : System

Initializes an empty instance of PieSlice.

TransformAngle ( float angle ) : float

Transforms actual angle to angle used for rendering. They are different because of perspective.

Private Methods

Method Description
BottomSurfaceSectionContainsPoint ( PointF point ) : bool

Checks if bottom side of the pie slice contains the point.

CreatePathForCylinderSurfaceSection ( float startAngle, float endAngle, PointF pointStart, PointF pointEnd ) : GraphicsPath

Creates GraphicsPath for cylinder surface section. This path consists of two arcs and two vertical lines.

CylinderSurfaceSectionContainsPoint ( PointF point, float startAngle, float endAngle, PointF point1, PointF point2 ) : bool

Checks if given point is contained within upper and lower pie slice surfaces or within the outer slice brink.

DrawBottom ( Graphics graphics ) : void

Draws the bottom of the pie slice.

DrawEndSide ( Graphics graphics ) : void

Draws visible end side.

DrawHiddenPeriphery ( Graphics graphics ) : void

Draws hidden outer periphery of the pie slice.

DrawSides ( Graphics graphics ) : void

Draws pie slice sides.

DrawStartSide ( Graphics graphics ) : void

Draws visible start side.

DrawTop ( Graphics graphics ) : void

Draws the top of the pie slice.

DrawVisiblePeriphery ( Graphics graphics ) : void

Draws visible outer periphery of the pie slice.

EndSideContainsPoint ( PointF point ) : bool

Checks if point provided is inside pie slice end cut side.

GetEllipseRadius ( double angle ) : double

Evaluates the distance of an ellipse perimeter point for a given angle.

GetFittingRectangle ( ) : RectangleF

Calculates the smallest rectangle into which this pie slice fits.

GetHiddenPeripherySurfaceBounds ( ) : PeripherySurfaceBounds[]

Gets an array of hidden periphery bounds.

GetVisiblePeripherySurfaceBounds ( ) : PeripherySurfaceBounds[]

Gets an array of visible periphery bounds.

InitializePieSlice ( float xBoundingRect, float yBoundingRect, float widthBoundingRect, float heightBoundingRect, float sliceHeight ) : void

Initializes pie bounding rectangle, pie height, corners coordinates and brushes used for rendering.

InitializeSides ( ) : void

Initializes start and end pie slice sides.

InitializeSides ( bool startSideExists, bool endSideExists ) : void

Initializes start and end pie slice sides.

PeripheryContainsPoint ( PointF point ) : bool

Checks if given point is contained by cylinder periphery.

PieSliceContainsPoint ( PointF point ) : bool

Checks if given point is contained inside the pie slice.

PieSliceContainsPoint ( PointF point, float xBoundingRectangle, float yBoundingRectangle, float widthBoundingRectangle, float heightBoundingRectangle, float startAngle, float sweepAngle ) : bool

Checks if point given is contained within the pie slice.

Readjust ( float xBoundingRect, float yBoundingRect, float widthBoundingRect, float heightBoundingRect, float sliceHeight ) : void

Reajusts the pie slice to fit new bounding rectangle provided.

Split ( float splitAngle ) : System.Drawing.PieChart.PieSlice[]

Splits a pie slice into two on the split angle.

StartSideContainsPoint ( PointF point ) : bool

Checks if point provided is inside pie slice start cut side.

Method Details

Contains() public method

Checks if given pie slice contains given point.
public Contains ( PointF point ) : bool
point System.Drawing.PointF /// PointF to check. ///
return bool

CreateBrushForPeriphery() protected method

Creates a brush for outer periphery of the pie slice used for gradual shadow.
protected CreateBrushForPeriphery ( Color color ) : Brush
color Color /// Color used for pie slice rendering. ///
return System.Drawing.Brush

CreateBrushForSide() protected method

Creates a brush for start and end sides of the pie slice for gradual shade.
protected CreateBrushForSide ( Color color, double angle ) : Brush
color Color /// Color used for pie slice rendering. ///
angle double /// Angle of the surface. ///
return System.Drawing.Brush

CreateSurfaceBrushes() protected method

Creates brushes used to render the pie slice.
protected CreateSurfaceBrushes ( Color surfaceColor, ShadowStyle shadowStyle ) : void
surfaceColor Color /// Color used for rendering. ///
shadowStyle ShadowStyle /// Shadow style used for rendering. ///
return void

Dispose() public method

Disposes of all resources used by PieSlice object.
public Dispose ( ) : void
return void

DisposeBrushes() protected method

Disposes of brush objects.
protected DisposeBrushes ( ) : void
return void

Draw() public method

Draws the pie slice.
public Draw ( Graphics graphics ) : void
graphics System.Drawing.Graphics /// Graphics used to draw the pie slice. ///
return void

DrawCylinderSurfaceSection() protected method

Draws the outer periphery of the pie slice.
protected DrawCylinderSurfaceSection ( Graphics graphics, Pen pen, Brush brush, float startAngle, float endAngle, PointF pointStart, PointF pointEnd ) : void
graphics System.Drawing.Graphics /// Graphics object used to draw the surface. ///
pen System.Drawing.Pen /// Pen used to draw outline. ///
brush System.Drawing.Brush /// Brush used to fill the quadrilateral. ///
startAngle float /// Start angle (in degrees) of the periphery section. ///
endAngle float /// End angle (in degrees) of the periphery section. ///
pointStart System.Drawing.PointF /// Point representing the start of the periphery. ///
pointEnd System.Drawing.PointF /// Point representing the end of the periphery. ///
return void

GetActualAngle() protected method

Gets the actual angle from the rendering angle.
protected GetActualAngle ( float transformedAngle ) : float
transformedAngle float /// Transformed angle for which actual angle has to be evaluated. ///
return float

GetTextPosition() public method

Evaluates the point in the middle of the slice.
public GetTextPosition ( ) : PointF
return System.Drawing.PointF

PeripheralPoint() protected method

Calculates the point on ellipse periphery for angle.
protected PeripheralPoint ( float xCenter, float yCenter, float semiMajor, float semiMinor, float angleDegrees ) : PointF
xCenter float /// x-coordinate of the center of the ellipse. ///
yCenter float /// y-coordinate of the center of the ellipse. ///
semiMajor float /// Horizontal semi-axis. ///
semiMinor float /// Vertical semi-axis. ///
angleDegrees float /// Angle (in degrees) for which corresponding periphery point has to /// be obtained. ///
return System.Drawing.PointF

PieSlice() protected method

Initializes an empty instance of PieSlice.
protected PieSlice ( ) : System
return System

PieSlice() public method

Initializes a new instance of PieSlice class with given bounds and visual style.
public PieSlice ( Rectangle boundingRect, float sliceHeight, float startAngle, float sweepAngle, Color surfaceColor, ShadowStyle shadowStyle, EdgeColorType edgeColorType, float edgeLineWidth ) : System
boundingRect System.Drawing.Rectangle /// Bounding rectangle used to draw the top surface of the pie slice. ///
sliceHeight float /// Pie slice height. ///
startAngle float /// Starting angle (in degrees) of the pie slice. ///
sweepAngle float /// Sweep angle (in degrees) of the pie slice. ///
surfaceColor Color /// Color used to render pie slice surface. ///
shadowStyle ShadowStyle /// Shadow style used in rendering. ///
edgeColorType EdgeColorType /// Edge color type used for rendering. ///
edgeLineWidth float /// Edge line width. ///
return System

PieSlice() public method

Initializes a new instance of PieSlice class with given bounds and visual style.
public PieSlice ( RectangleF boundingRect, float sliceHeight, float startAngle, float sweepAngle, Color surfaceColor, ShadowStyle shadowStyle, EdgeColorType edgeColorType ) : System
boundingRect System.Drawing.RectangleF /// Bounding rectangle used to draw the top surface of the slice. ///
sliceHeight float /// Pie slice height. ///
startAngle float /// Starting angle (in degrees) of the pie slice. ///
sweepAngle float /// Sweep angle (in degrees) of the pie slice. ///
surfaceColor Color /// Color used to render pie slice surface. ///
shadowStyle ShadowStyle /// Shadow style used in rendering. ///
edgeColorType EdgeColorType /// Edge color type used for rendering. ///
return System

PieSlice() public method

Initializes a new instance of flat PieSlice class with given bounds and visual style.
public PieSlice ( float xBoundingRect, float yBoundingRect, float widthBoundingRect, float heightBoundingRect, float startAngle, float sweepAngle, Color surfaceColor ) : System
xBoundingRect float /// x-coordinate of the upper-left corner of the rectangle that is /// used to draw the top surface of the pie slice. ///
yBoundingRect float /// y-coordinate of the upper-left corner of the rectangle that is /// used to draw the top surface of the pie slice. ///
widthBoundingRect float /// Width of the rectangle that is used to draw the top surface of /// the pie slice. ///
heightBoundingRect float /// Height of the rectangle that is used to draw the top surface of /// the pie slice. ///
startAngle float /// Starting angle (in degrees) of the pie slice. ///
sweepAngle float /// Sweep angle (in degrees) of the pie slice. ///
surfaceColor Color /// Color used to paint the pie slice. ///
return System

PieSlice() public method

Initializes a new instance of PieSlice class with given bounds and visual style.
public PieSlice ( float xBoundingRect, float yBoundingRect, float widthBoundingRect, float heightBoundingRect, float sliceHeight, float startAngle, float sweepAngle, Color surfaceColor, ShadowStyle shadowStyle, EdgeColorType edgeColorType ) : System
xBoundingRect float /// x-coordinate of the upper-left corner of the rectangle that is /// used to draw the top surface of the pie slice. ///
yBoundingRect float /// y-coordinate of the upper-left corner of the rectangle that is /// used to draw the top surface of the pie slice. ///
widthBoundingRect float /// Width of the rectangle that is used to draw the top surface of /// the pie slice. ///
heightBoundingRect float /// Height of the rectangle that is used to draw the top surface of /// the pie slice. ///
sliceHeight float /// Height of the pie slice. ///
startAngle float /// Starting angle (in degrees) of the pie slice. ///
sweepAngle float /// Sweep angle (in degrees) of the pie slice. ///
surfaceColor Color /// Color used to paint the pie slice. ///
shadowStyle ShadowStyle /// Shadow style used for slice rendering. ///
edgeColorType EdgeColorType /// Edge color style used for slice rendering. ///
return System

PieSlice() public method

Initializes a new instance of PieSlice class with given bounds and visual style.
public PieSlice ( float xBoundingRect, float yBoundingRect, float widthBoundingRect, float heightBoundingRect, float sliceHeight, float startAngle, float sweepAngle, Color surfaceColor, ShadowStyle shadowStyle, EdgeColorType edgeColorType, float edgeLineWidth ) : System
xBoundingRect float /// x-coordinate of the upper-left corner of the rectangle that is /// used to draw the top surface of the pie slice. ///
yBoundingRect float /// y-coordinate of the upper-left corner of the rectangle that is /// used to draw the top surface of the pie slice. ///
widthBoundingRect float /// Width of the rectangle that is used to draw the top surface of /// the pie slice. ///
heightBoundingRect float /// Height of the rectangle that is used to draw the top surface of /// the pie slice. ///
sliceHeight float /// Height of the pie slice. ///
startAngle float /// Starting angle (in degrees) of the pie slice. ///
sweepAngle float /// Sweep angle (in degrees) of the pie slice. ///
surfaceColor Color /// Color used to render pie slice surface. ///
shadowStyle ShadowStyle /// Shadow style used in rendering. ///
edgeColorType EdgeColorType /// Edge color type used for rendering. ///
edgeLineWidth float /// Edge line width. ///
return System

TransformAngle() protected method

Transforms actual angle to angle used for rendering. They are different because of perspective.
protected TransformAngle ( float angle ) : float
angle float /// Actual angle. ///
return float

Property Details

m_boundingRectangle protected_oe property

Bounding rectangle that bounds the ellipse from which pie slice is cut.
protected RectangleF,System.Drawing m_boundingRectangle
return System.Drawing.RectangleF

m_brushEndSide protected_oe property

Brush used to render slice ending cut side.
protected Brush,System.Drawing m_brushEndSide
return System.Drawing.Brush

m_brushPeripherySurface protected_oe property

Brush used to render pie slice periphery (cylinder outer surface).
protected Brush,System.Drawing m_brushPeripherySurface
return System.Drawing.Brush

m_brushStartSide protected_oe property

Brush used to render slice starting cut side.
protected Brush,System.Drawing m_brushStartSide
return System.Drawing.Brush

m_brushSurface protected_oe property

Brush used to render slice top surface.
protected Brush,System.Drawing m_brushSurface
return System.Drawing.Brush

m_brushSurfaceHighlighted protected_oe property

Brush used to render slice top surface when highlighted.
protected Brush,System.Drawing m_brushSurfaceHighlighted
return System.Drawing.Brush

m_center protected_oe property

PointF corresponding to pie slice center.
protected PointF,System.Drawing m_center
return System.Drawing.PointF

m_centerBelow protected_oe property

PointF corresponding to the lower pie slice center.
protected PointF,System.Drawing m_centerBelow
return System.Drawing.PointF

m_endSide protected_oe property

Quadrilateral representing the end side.
protected Quadrilateral,System.Drawing m_endSide
return System.Drawing.Quadrilateral

m_pen protected_oe property

Pen object used to draw pie slice edges.
protected Pen,System.Drawing m_pen
return System.Drawing.Pen

m_pointEnd protected_oe property

PointF on the periphery corresponding to the end cut side.
protected PointF,System.Drawing m_pointEnd
return System.Drawing.PointF

m_pointEndBelow protected_oe property

PointF on the periphery corresponding to the end cut side.
protected PointF,System.Drawing m_pointEndBelow
return System.Drawing.PointF

m_pointStart protected_oe property

PointF on the periphery corresponding to the start cut side.
protected PointF,System.Drawing m_pointStart
return System.Drawing.PointF

m_pointStartBelow protected_oe property

PointF on the periphery corresponding to the start cut side.
protected PointF,System.Drawing m_pointStartBelow
return System.Drawing.PointF

m_sliceHeight protected_oe property

Pie slice height.
protected float m_sliceHeight
return float

m_startAngle protected_oe property

Start angle.
protected float m_startAngle
return float

m_startSide protected_oe property

Quadrilateral representing the start side.
protected Quadrilateral,System.Drawing m_startSide
return System.Drawing.Quadrilateral

m_sweepAngle protected_oe property

Sweep angle.
protected float m_sweepAngle
return float