In This Article

Border Class

Provides a base class for an object that can be used as a border.

[TypeConverter(typeof(GenericExpandableNullableObjectConverter))]
public abstract class Border : ICloneable
Inheritance:
object object
Derived:
SimpleBorder
Implements:
ICloneable

Constructors

Border()

Initializes an instance of the class.

protected Border()

Border(Border)

Initializes an instance of the class.

protected Border(Border copyFrom)
Parameter Type Description
copyFrom Border

An instance of Border which will be copied to initialize the new instance.

Remarks

This constructor used in support of Clone() for base classes to initialize their fields.

Methods

Clone()

Creates an exact duplicate of the Border object.

public abstract Border Clone()

Returns

Border

Draw(Graphics, Rectangle)

Draws the border on all sides.

public virtual void Draw(Graphics g, Rectangle bounds)
Parameter Type Description
g Graphics

The Graphics object used to paint.

bounds Rectangle

The bounds of the area to paint.

Draw(Graphics, Rectangle, Sides)

Draws the border.

public abstract void Draw(Graphics g, Rectangle bounds, Sides sides)
Parameter Type Description
g Graphics

The Graphics object used to paint.

bounds Rectangle

The bounds of the area to paint.

sides Sides

The Sides of the border to draw.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)
Parameter Type Description
obj object

The object to compare with the current object.

Returns

bool:

true if the specified object is equal to the current object; otherwise, false.

GetBorderWidth()

The width of the border.

public abstract int GetBorderWidth()

Returns

int

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int:

A hash code for the current object.

GetInnerBounds(Graphics?, Rectangle, Sides)

Returns the area inside the given bounds after the border has been applied to the given sides.

public virtual Rectangle GetInnerBounds(Graphics? g, Rectangle bounds, Sides sides = Sides.All)
Parameter Type Description
g Graphics

The Graphics object used to paint.

bounds Rectangle

The bounds where the border would be rendered.

sides Sides

The sides of the border that would be rendered.

Returns

Rectangle:

The original bounds offset and size-adjusted to compensate for the borders.

GetPrimaryColor()

Returns the primary Color of the border.

public abstract Color GetPrimaryColor()

Returns

Color

OnPropertyChanged(EventArgs)

Raises the PropertyChanged event.

protected virtual void OnPropertyChanged(EventArgs e)
Parameter Type Description
e EventArgs

The event data.

Events

PropertyChanged

Occurs after a property is changed.

public event EventHandler? PropertyChanged

Event Type

EventHandler

Inherited Members

Extension Methods