DrawingExtensions Class
Provides extension methods for the types from the System.Drawing and ActiproSoftware.UI.WinForms.Drawing namespaces.
public static class DrawingExtensions
- Inheritance:
- object object
Methods
DeflateSides(Rectangle, Sides, int)
Deflates the sides of a rectangle keeping the position of the other sides intact. For example, deflating the top of a rectangle will reduce the overall height and offset the rectangle down to keep the bottom side in the same position.
public static Rectangle DeflateSides(this Rectangle value, Sides sides, int delta)
| Parameter | Type | Description |
|---|---|---|
| value | Rectangle | The rectangle to be deflated. |
| sides | Sides | The side(s) to deflate. |
| delta | int | The amount of the deflation (negative values will inflate). |
Returns
- Rectangle:
The new rectangle with the given sides deflated.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the value does not define a single side. |
See Also
ForSide(Padding, Sides)
Gets the padding for the given side.
public static int ForSide(this Padding value, Sides side)
| Parameter | Type | Description |
|---|---|---|
| value | Padding | The padding to examine. |
| side | Sides | The side whose padding value should be returned. |
Returns
- int:
The padding value of the given side.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when the |
GetSideBounds(Rectangle, Sides, int)
Gets the bounds of the side of a rectangle.
public static Rectangle GetSideBounds(this Rectangle value, Sides side, int ascent)
| Parameter | Type | Description |
|---|---|---|
| value | Rectangle | The bounds of the original rectangle. |
| side | Sides | The side whose bounds should be returned. |
| ascent | int | The size measurement of the returned bounds for the dimension that is perpendicular to the given side (e.g., width of left/right side or height of top/bottom side). |
Returns
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown when the |
| ArgumentException | Thrown when the |
InflateSides(Rectangle, Sides, int)
Inflates the sides of a rectangle keeping the position of the other sides intact. For example, inflating the top of a rectangle will increase the overall height and offset the rectangle up to keep the bottom side in the same position.
public static Rectangle InflateSides(this Rectangle value, Sides sides, int delta)
| Parameter | Type | Description |
|---|---|---|
| value | Rectangle | The rectangle to be inflated. |
| sides | Sides | The side(s) to inflate. |
| delta | int | The amount of the inflation (negative values will deflate). |
Returns
- Rectangle:
The new rectangle with the given sides inflated.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the value does not define a single side. |
See Also
InnerBounds(Rectangle, Padding)
Gets the bounds inside of the given Rectangle after applying padding.
public static Rectangle InnerBounds(this Rectangle value, Padding padding)
| Parameter | Type | Description |
|---|---|---|
| value | Rectangle | The rectangle whose inner bounds are to be determined. |
| padding | Padding | The padding to apply inside of the given Rectangle. |
Returns
- Rectangle:
The new rectangle with the given padding applied to the inside.
Invert(Sides)
Gets the Sides that are the inverse of the given value.
public static Sides Invert(this Sides value)
| Parameter | Type | Description |
|---|---|---|
| value | Sides | The value to examine. |
Returns
IsDarkColorScheme(WindowsColorSchemeIntent)
Returns whether the WindowsColorSchemeIntent is intended for darker colors.
public static bool IsDarkColorScheme(this WindowsColorSchemeIntent intent)
| Parameter | Type | Description |
|---|---|---|
| intent | WindowsColorSchemeIntent | The color scheme intent. |
Returns
- bool:
trueif the WindowsColorSchemeIntent is intended for darker colors; otherwise,false.
IsEllipses(StringTrimming)
Gets whether the specified StringTrimming is one that uses ellipses.
public static bool IsEllipses(this StringTrimming trimming)
| Parameter | Type | Description |
|---|---|---|
| trimming | StringTrimming | The StringTrimming to examine. |
Returns
- bool:
trueif the specified StringTrimming uses ellipses one; otherwise,false.
IsSingleSide(Sides)
Tests the Sides value to see if it defines a single side.
public static bool IsSingleSide(this Sides value)
| Parameter | Type | Description |
|---|---|---|
| value | Sides | The value to test. |
Returns
- bool:
trueif the value defines a single side; otherwise,falseif the value has flags for multiple sides or is not a recognized value.
OppositeSide(Sides)
Gets the Sides value that is the opposite of the given value.
public static Sides OppositeSide(this Sides value)
| Parameter | Type | Description |
|---|---|---|
| value | Sides | The value to examine, which must define a single side only. |
Returns
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the value does not define a single side. |
OuterBounds(Rectangle, Padding)
Gets the bounds outside of the given Rectangle after applying padding.
public static Rectangle OuterBounds(this Rectangle value, Padding padding)
| Parameter | Type | Description |
|---|---|---|
| value | Rectangle | The rectangle whose outer bounds are to be determined. |
| padding | Padding | The padding to apply outside of the given Rectangle. |
Returns
- Rectangle:
The new rectangle with the given padding applied to the outside.
ResolvedColorScheme(IUIRenderer)
Resolves the best IWindowsColorScheme to be used for the given IUIRenderer.
public static IWindowsColorScheme ResolvedColorScheme(this IUIRenderer renderer)
| Parameter | Type | Description |
|---|---|---|
| renderer | IUIRenderer | The IUIRenderer to examine, or |
Returns
- IWindowsColorScheme:
The assigned value of ColorScheme or a default IWindowsColorScheme if the
rendereror its assigned property arenull.
Remarks
This method will always return a non-null value and may be used instead of ColorScheme
if the instance of IUIRenderer or ColorScheme might be null.
ToSide(DockStyle)
public static Sides ToSide(this DockStyle value)
| Parameter | Type | Description |
|---|---|---|
| value | DockStyle | The DockStyle to examine. |