Class Border
Represents a border.
public abstract class Border
- Inheritance
-
Border
- Derived
- Inherited Members
Constructors
Border(float)
Creates a border with the given width.
protected Border(float width)
Parameters
width
floatthe width which the border should have
Remarks
Border(Color, float)
protected Border(Color color, float width)
Parameters
color
Colorthe color which the border should have
width
floatthe width which the border should have
Border(Color, float, float)
protected Border(Color color, float width, float opacity)
Parameters
color
Colorthe color which the border should have
width
floatthe width which the border should have
opacity
floatthe opacity which border should have; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent
Fields
DASHED
The dashed border.
public const int DASHED = 1
Field Value
- See Also
DASHED_FIXED
The fixed dashed border.
public const int DASHED_FIXED = 9
Field Value
- See Also
DOTTED
The dotted border.
public const int DOTTED = 2
Field Value
- See Also
DOUBLE
The double border.
public const int DOUBLE = 3
Field Value
- See Also
NO_BORDER
The null Border, i.e. the presence of such border is equivalent to the absence of the border
public static readonly Border NO_BORDER
Field Value
ROUND_DOTS
The round-dots border.
public const int ROUND_DOTS = 4
Field Value
- See Also
SOLID
The solid border.
public const int SOLID = 0
Field Value
- See Also
_3D_GROOVE
The 3D groove border.
public const int _3D_GROOVE = 5
Field Value
- See Also
_3D_INSET
The 3D inset border.
public const int _3D_INSET = 6
Field Value
- See Also
_3D_OUTSET
The 3D outset border.
public const int _3D_OUTSET = 7
Field Value
- See Also
_3D_RIDGE
The 3D ridge border.
public const int _3D_RIDGE = 8
Field Value
- See Also
transparentColor
The color of the border.
protected TransparentColor transparentColor
Field Value
- See Also
type
The type of the border.
protected int type
Field Value
width
The width of the border.
protected float width
Field Value
Methods
Draw(PdfCanvas, float, float, float, float, float, float, float, float, Side, float, float)
All borders are supposed to be drawn in such way, that inner content of the element is on the right from the drawing direction.
public virtual void Draw(PdfCanvas canvas, float x1, float y1, float x2, float y2, float horizontalRadius1, float verticalRadius1, float horizontalRadius2, float verticalRadius2, Border.Side defaultSide, float borderWidthBefore, float borderWidthAfter)
Parameters
canvas
PdfCanvasPdfCanvas to be written to
x1
floatx coordinate of the beginning point of the element side, that should be bordered
y1
floaty coordinate of the beginning point of the element side, that should be bordered
x2
floatx coordinate of the ending point of the element side, that should be bordered
y2
floaty coordinate of the ending point of the element side, that should be bordered
horizontalRadius1
floatdefines the horizontal radius of the border's first corner
verticalRadius1
floatdefines the vertical radius of the border's first corner
horizontalRadius2
floatdefines the horizontal radius of the border's second corner
verticalRadius2
floatdefines the vertical radius of the border's second corner
defaultSide
Border.Sidethe Border.Side , that we will fallback to, if it cannot be determined by border coordinates
borderWidthBefore
floatdefines width of the border that is before the current one
borderWidthAfter
floatdefines width of the border that is after the current one
Remarks
All borders are supposed to be drawn in such way, that inner content of the element is on the right from the drawing direction. Borders are drawn in this order: top, right, bottom, left.
Given points specify the line which lies on the border of the content area, therefore the border itself should be drawn to the left from the drawing direction.borderWidthBefore
and borderWidthAfter
parameters are used to
define the widths of the borders that are before and after the current border, e.g. for
the bottom border, borderWidthBefore
specifies width of the right border and
borderWidthAfter
- width of the left border. Those width are used to handle areas
of border joins.
horizontalRadius1
, verticalRadius1
, horizontalRadius2
and verticalRadius2
are used to draw rounded borders.
Draw(PdfCanvas, float, float, float, float, float, Side, float, float)
All borders are supposed to be drawn in such way, that inner content of the element is on the right from the drawing direction.
public virtual void Draw(PdfCanvas canvas, float x1, float y1, float x2, float y2, float borderRadius, Border.Side defaultSide, float borderWidthBefore, float borderWidthAfter)
Parameters
canvas
PdfCanvasPdfCanvas to be written to
x1
floatx coordinate of the beginning point of the element side, that should be bordered
y1
floaty coordinate of the beginning point of the element side, that should be bordered
x2
floatx coordinate of the ending point of the element side, that should be bordered
y2
floaty coordinate of the ending point of the element side, that should be bordered
borderRadius
floatdefines the radius of the element's corners
defaultSide
Border.Sidethe Border.Side , that we will fallback to, if it cannot be determined by border coordinates
borderWidthBefore
floatdefines width of the border that is before the current one
borderWidthAfter
floatdefines width of the border that is after the current one
Remarks
All borders are supposed to be drawn in such way, that inner content of the element is on the right from the drawing direction. Borders are drawn in this order: top, right, bottom, left.
Given points specify the line which lies on the border of the content area, therefore the border itself should be drawn to the left from the drawing direction.borderWidthBefore
and borderWidthAfter
parameters are used to
define the widths of the borders that are before and after the current border, e.g. for
the bottom border, borderWidthBefore
specifies width of the right border and
borderWidthAfter
- width of the left border. Those width are used to handle areas
of border joins.
borderRadius
is used to draw rounded borders.
Draw(PdfCanvas, float, float, float, float, Side, float, float)
All borders are supposed to be drawn in such way, that inner content of the element is on the right from the drawing direction.
public abstract void Draw(PdfCanvas canvas, float x1, float y1, float x2, float y2, Border.Side defaultSide, float borderWidthBefore, float borderWidthAfter)
Parameters
canvas
PdfCanvasPdfCanvas to be written to
x1
floatx coordinate of the beginning point of the element side, that should be bordered
y1
floaty coordinate of the beginning point of the element side, that should be bordered
x2
floatx coordinate of the ending point of the element side, that should be bordered
y2
floaty coordinate of the ending point of the element side, that should be bordered
defaultSide
Border.Sidethe Border.Side , that we will fallback to, if it cannot be determined by border coordinates
borderWidthBefore
floatdefines width of the border that is before the current one
borderWidthAfter
floatdefines width of the border that is after the current one
Remarks
All borders are supposed to be drawn in such way, that inner content of the element is on the right from the drawing direction. Borders are drawn in this order: top, right, bottom, left.
Given points specify the line which lies on the border of the content area, therefore the border itself should be drawn to the left from the drawing direction.borderWidthBefore
and borderWidthAfter
parameters are used to
define the widths of the borders that are before and after the current border, e.g. for
the bottom border, borderWidthBefore
specifies width of the right border and
borderWidthAfter
- width of the left border. Those width are used to handle areas
of border joins.
Draw(PdfCanvas, Rectangle)
Draw borders around the target rectangle.
public virtual void Draw(PdfCanvas canvas, Rectangle rectangle)
Parameters
DrawCellBorder(PdfCanvas, float, float, float, float, Side)
Draws the border of a cell.
public abstract void DrawCellBorder(PdfCanvas canvas, float x1, float y1, float x2, float y2, Border.Side defaultSide)
Parameters
canvas
PdfCanvasPdfCanvas to be written to
x1
floatx coordinate of the beginning point of the element side, that should be bordered
y1
floaty coordinate of the beginning point of the element side, that should be bordered
x2
floatx coordinate of the ending point of the element side, that should be bordered
y2
floaty coordinate of the ending point of the element side, that should be bordered
defaultSide
Border.Sidethe Border.Side , that we will fallback to, if it cannot be determined by border coordinates
DrawDiscontinuousBorders(PdfCanvas, Rectangle, float[], float[], Side, float, float)
Perform drawing operations to draw discontinuous borders.
protected virtual void DrawDiscontinuousBorders(PdfCanvas canvas, Rectangle boundingRectangle, float[] horizontalRadii, float[] verticalRadii, Border.Side defaultSide, float borderWidthBefore, float borderWidthAfter)
Parameters
canvas
PdfCanvascanvas to draw on
boundingRectangle
Rectanglerectangle representing the bounding box of the drawing operations
horizontalRadii
float[]the horizontal radius of the border's two corners
verticalRadii
float[]the vertical radius of the border's two corners
defaultSide
Border.Sidethe Border.Side , that we will fallback to, if it cannot be determined by border coordinates
borderWidthBefore
floatdefines width of the border that is before the current one
borderWidthAfter
floatdefines width of the border that is after the current one
Remarks
Perform drawing operations to draw discontinuous borders. Used by DashedBorder , DottedBorder and RoundDotsBorder.
Equals(object)
Indicates whether the border is equal to the given border.
public override bool Equals(object anObject)
Parameters
anObject
object
Returns
Remarks
Indicates whether the border is equal to the given border. The border type, width and color are considered during the comparison.
GetBorderSide(float, float, float, float, Side)
Returns the side corresponded to the line between two points.
protected virtual Border.Side GetBorderSide(float x1, float y1, float x2, float y2, Border.Side defaultSide)
Parameters
x1
floatthe abscissa of the left-bottom point
y1
floatthe ordinate of the left-bottom point
x2
floatthe abscissa of the right-top point
y2
floatthe ordinate of the right-top point
defaultSide
Border.Sidethe default side of border
Returns
Remarks
Returns the side corresponded to the line between two points. Notice that we consider the rectangle traversal to be clockwise. In case side couldn't be detected we will fallback to default side
GetBorderType()
Returns the type of the border
public abstract int GetBorderType()
Returns
- int
the type of border.
GetColor()
public virtual Color GetColor()
Returns
GetDotsGap(double, float)
Adjusts the size of the gap between dots
protected virtual float GetDotsGap(double distance, float initialGap)
Parameters
Returns
- float
the adjusted size of the gap
GetHashCode()
public override int GetHashCode()
Returns
GetIntersectionPoint(Point, Point, Point, Point)
Gets a Point in which two lines intersect.
protected virtual Point GetIntersectionPoint(Point lineBeg, Point lineEnd, Point clipLineBeg, Point clipLineEnd)
Parameters
lineBeg
Pointa Point which defines some point on the first line
lineEnd
Pointa Point which defines another point on the first line
clipLineBeg
Pointa Point which defines some point on the second line
clipLineEnd
Pointa Point which defines another point on the second line
Returns
GetOpacity()
Gets the opacity of the border
public virtual float GetOpacity()
Returns
- float
the border opacity; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent
GetStartingPointsForBorderSide(float, float, float, float, Side)
Calculate adjusted starting points for discontinuous borders, given two opposing points (A and B) that define the bounding rectangle
protected virtual float[] GetStartingPointsForBorderSide(float x1, float y1, float x2, float y2, Border.Side defaultSide)
Parameters
x1
floatx-coordinate of point A
y1
floaty-ordinate of point A
x2
floatx-coordinate of point B
y2
floaty-ordinate of point B
defaultSide
Border.Sidedefault side of the border used to determine the side given by points A and B
Returns
- float[]
float[] containing the adjusted starting points in the form {x1,y1,x2,y2}
GetWidth()
Gets the width of the border
public virtual float GetWidth()
Returns
- float
the width
SetColor(Color)
public virtual void SetColor(Color color)
Parameters
color
ColorThe color
SetWidth(float)
Sets the width of the border
public virtual void SetWidth(float width)
Parameters
width
floatThe width