OrientedElementExtensions Class
Provides extension methods for the type IOrientedElement.
public static class OrientedElementExtensions
- Inheritance:
- object object
Remarks
Many of the methods refer to the terms 'extent' and 'ascent'. For elements with horizontal orientation, the extent is along the x-axis and the the ascent is along the y-axis. Conversely, for elements with vertical orientation, the ascent is along the x-axis and the the extent is along the y-axis.
Methods
CreatePoint(IOrientedElement, int, int)
Creates a Point comprised of the specified extent and ascent locations.
public static Point CreatePoint(this IOrientedElement element, int extentLocation, int ascentLocation)
Parameter | Type | Description |
---|---|---|
element | IOrientedElement | The element with orientation to examine. |
extentLocation | int | The extent location. |
ascentLocation | int | The ascent location. |
Returns
Remarks
For horizontal orientation, the X location will be the extent location and the Y location will be the ascent location. For vertical orientation, the X location will be the ascent location and the Y location will be the extent location.
CreateRect(IOrientedElement, int, int, int, int)
Creates a Rectangle comprised of the specified extent and ascent locations/lengths.
public static Rectangle CreateRect(this IOrientedElement element, int extentLocation, int ascentLocation, int extentLength, int ascentLength)
Parameter | Type | Description |
---|---|---|
element | IOrientedElement | The element with orientation to examine. |
extentLocation | int | The extent location. |
ascentLocation | int | The ascent location. |
extentLength | int | The extent length. |
ascentLength | int | The ascent length. |
Returns
Remarks
For horizontal orientation, the X location will be the extent location, the Y location will be the ascent location, the width will be the extent length, and the height will be the ascent length For vertical orientation, the X location will be the ascent location, the Y location will be the extent location, the width will be the ascent length, and the height will be the extent length
CreateSize(IOrientedElement, int, int)
Creates a Size comprised of the specified extent and ascent lengths.
public static Size CreateSize(this IOrientedElement element, int extentLength, int ascentLength)
Parameter | Type | Description |
---|---|---|
element | IOrientedElement | The element with orientation to examine. |
extentLength | int | The extent length. |
ascentLength | int | The ascent length. |
Returns
Remarks
For horizontal orientation, the width will be the extent length and the height will be the ascent length. For vertical orientation, the width will be the ascent length and the height will be the extent length.
GetLocationAscent(IOrientedElement, Point)
Returns the location ascent of the specified Point, based on the orientation of the element.
public static int GetLocationAscent(this IOrientedElement element, Point location)
Parameter | Type | Description |
---|---|---|
element | IOrientedElement | The element with orientation to examine. |
location | Point | The Point to examine. |
Returns
Remarks
For horizontal orientation, the ascent will be the Y
value.
For vertical orientation, the ascent will be the X
value.
GetLocationAscent(IOrientedElement, Rectangle)
Returns the location ascent of the specified Rectangle, based on the orientation of the element.
public static int GetLocationAscent(this IOrientedElement element, Rectangle bounds)
Parameter | Type | Description |
---|---|---|
element | IOrientedElement | The element with orientation to examine. |
bounds | Rectangle | The Rectangle to examine. |
Returns
Remarks
For horizontal orientation, the ascent will be the Y
value.
For vertical orientation, the ascent will be the X
value.
GetLocationExtent(IOrientedElement, Point)
Returns the location extent of the specified Point, based on the orientation of the element.
public static int GetLocationExtent(this IOrientedElement element, Point location)
Parameter | Type | Description |
---|---|---|
element | IOrientedElement | The element with orientation to examine. |
location | Point | The Point to examine. |
Returns
Remarks
For horizontal orientation, the extent will be the X
value.
For vertical orientation, the extent will be the Y
value.
GetLocationExtent(IOrientedElement, Rectangle)
Returns the location extent of the specified Rectangle, based on the orientation of the element.
public static int GetLocationExtent(this IOrientedElement element, Rectangle bounds)
Parameter | Type | Description |
---|---|---|
element | IOrientedElement | The element with orientation to examine. |
bounds | Rectangle | The Rectangle to examine. |
Returns
Remarks
For horizontal orientation, the extent will be the X
value.
For vertical orientation, the extent will be the Y
value.
GetOrientedValue<T>(IOrientedElement, Func<T>, Func<T>)
Returns the appropriate value based on the orientation of the element.
public static T GetOrientedValue<T>(this IOrientedElement element, Func<T> horizontalValueFactory, Func<T> verticalValueFactory)
- Type Parameters:
-
T
-The type of value to be returned.
Parameter | Type | Description |
---|---|---|
element | IOrientedElement | The element with orientation to examine. |
horizontalValueFactory | Func<T> | The factory method which will provide the value for horizontally-oriented elements. |
verticalValueFactory | Func<T> | The factory method which will provide the value for vertically-oriented elements. |
Returns
- T:
the value returned by
horizontalValueFactory
orverticalValueFactory
, based on the orientation of the element.
GetOrientedValue<T>(IOrientedElement, T, T)
Returns the appropriate value based on the orientation of the element.
public static T GetOrientedValue<T>(this IOrientedElement element, T horizontalValue, T verticalValue)
- Type Parameters:
-
T
-The type of value to be returned.
Parameter | Type | Description |
---|---|---|
element | IOrientedElement | The element with orientation to examine. |
horizontalValue | T | The value to return for horizontally-oriented elements. |
verticalValue | T | The value to return for vertically-oriented elements. |
Returns
- T:
The
horizontalValue
orverticalValue
, based on the orientation of the element.
GetPoint(IOrientedElement, int, int)
Returns a new point with the specified extent
and ascent
, based on the orientation of the element.
public static Point GetPoint(this IOrientedElement element, int extent, int ascent)
Parameter | Type | Description |
---|---|---|
element | IOrientedElement | The element with orientation to examine. |
extent | int | The extent of the point, based on the orientation of the element. |
ascent | int | The ascent of the point, based on the orientation of the element. |
Returns
Remarks
For horizontal orientation, the X
coordinate will be the extent and the Y
coordinate will be the ascent.
For vertical orientation, the X
coordinate will be the ascent and the Y
coordinate will be the extent.
GetSizeAscent(IOrientedElement, Rectangle)
Returns the size ascent of the specified Rectangle, based on the orientation of the element.
public static int GetSizeAscent(this IOrientedElement element, Rectangle bounds)
Parameter | Type | Description |
---|---|---|
element | IOrientedElement | The element with orientation to examine. |
bounds | Rectangle | The Rectangle to examine. |
Returns
Remarks
For horizontal orientation, the ascent will be the height. For vertical orientation, the ascent will be the width.
GetSizeAscent(IOrientedElement, Size)
Returns the size ascent of the specified Size, based on the orientation of the element.
public static int GetSizeAscent(this IOrientedElement element, Size size)
Parameter | Type | Description |
---|---|---|
element | IOrientedElement | The element with orientation to examine. |
size | Size | The Size to examine. |
Returns
Remarks
For horizontal orientation, the ascent will be the height. For vertical orientation, the ascent will be the width.
GetSizeExtent(IOrientedElement, Rectangle)
Returns the size extent of the specified Rectangle, based on the orientation of the element.
public static int GetSizeExtent(this IOrientedElement element, Rectangle bounds)
Parameter | Type | Description |
---|---|---|
element | IOrientedElement | The element with orientation to examine. |
bounds | Rectangle | The Rectangle to examine. |
Returns
Remarks
For horizontal orientation, the extent will be the width. For vertical orientation, the extent will be the height.
GetSizeExtent(IOrientedElement, Size)
Returns the size extent of the specified Size, based on the orientation of the element.
public static int GetSizeExtent(this IOrientedElement element, Size size)
Parameter | Type | Description |
---|---|---|
element | IOrientedElement | The element with orientation to examine. |
size | Size | The Size to examine. |
Returns
Remarks
For horizontal orientation, the extent will be the width. For vertical orientation, the extent will be the height.
PerformOrientedAction(IOrientedElement, Action, Action)
Performs an action based on the orientation of the element.
public static void PerformOrientedAction(this IOrientedElement element, Action horizontalAction, Action verticalAction)
Parameter | Type | Description |
---|---|---|
element | IOrientedElement | The element with orientation to examine. |
horizontalAction | Action | The action to be performed for a horizontally-oriented element. |
verticalAction | Action | The action to be performed for a vertically-oriented element. |