DpiAwareElementExtensions Class
Provides extension methods for the type IDpiAwareElement.
public static class DpiAwareElementExtensions
- Inheritance:
- object object
Methods
AutoScaleFont(IDpiAwareElement, Font)
Automatically rescales a font if the scale factor for system DPI is different than scale factor where the font will be used.
public static Font AutoScaleFont(this IDpiAwareElement source, Font value)
Parameter | Type | Description |
---|---|---|
source | IDpiAwareElement | The element whose scale factor will be used to scale the value. |
value | Font | The value to be scaled. |
Returns
Remarks
This method assumes that fonts are automatically sized based on the system DPI and only per-monitor aware applications running in mixed DPI mode will have to adjust the font.
AutoScaleFontSize(IDpiAwareElement, float)
Automatically rescales a font size if the scale factor for system DPI is different than scale factor where the font will be used.
public static float AutoScaleFontSize(this IDpiAwareElement source, float value)
Parameter | Type | Description |
---|---|---|
source | IDpiAwareElement | The element whose scale factor will be used to scale the value. |
value | float | The value to be scaled. |
Returns
- float:
The font size scaled, as needed, to match the DPI of the device.
Remarks
This method assumes that fonts are automatically sized based on the system DPI and only per-monitor aware applications running in mixed DPI mode will have to adjust the font.
ScaleLogicalValue(IDpiAwareElement, Padding)
Scale a value in logical units by the current DpiScaleFactor.
public static Padding ScaleLogicalValue(this IDpiAwareElement source, Padding value)
Parameter | Type | Description |
---|---|---|
source | IDpiAwareElement | The element whose scale factor will be used to scale the value. |
value | Padding | The unscaled value in logical units. |
Returns
- Padding:
The scaled value.
ScaleLogicalValue(IDpiAwareElement, Point)
Scale a value in logical units by the current DpiScaleFactor.
public static Point ScaleLogicalValue(this IDpiAwareElement source, Point value)
Parameter | Type | Description |
---|---|---|
source | IDpiAwareElement | The element whose scale factor will be used to scale the value. |
value | Point | The unscaled value in logical units. |
Returns
- Point:
The scaled value.
ScaleLogicalValue(IDpiAwareElement, Rectangle)
Scale a value in logical units by the current DpiScaleFactor.
public static Rectangle ScaleLogicalValue(this IDpiAwareElement source, Rectangle value)
Parameter | Type | Description |
---|---|---|
source | IDpiAwareElement | The element whose scale factor will be used to scale the value. |
value | Rectangle | The unscaled value in logical units. |
Returns
- Rectangle:
The scaled value.
ScaleLogicalValue(IDpiAwareElement, Size)
Scale a value in logical units by the current DpiScaleFactor.
public static Size ScaleLogicalValue(this IDpiAwareElement source, Size value)
Parameter | Type | Description |
---|---|---|
source | IDpiAwareElement | The element whose scale factor will be used to scale the value. |
value | Size | The unscaled value in logical units. |
Returns
- Size:
The scaled value.
ScaleLogicalValue(IDpiAwareElement, SizeF)
Scale a value in logical units by the current DpiScaleFactor.
public static SizeF ScaleLogicalValue(this IDpiAwareElement source, SizeF value)
Parameter | Type | Description |
---|---|---|
source | IDpiAwareElement | The element whose scale factor will be used to scale the value. |
value | SizeF | The unscaled value in logical units. |
Returns
- SizeF:
The scaled value.
ScaleLogicalValue(IDpiAwareElement, int)
Scale a value in logical units by the current DpiScaleFactor.
public static int ScaleLogicalValue(this IDpiAwareElement source, int value)
Parameter | Type | Description |
---|---|---|
source | IDpiAwareElement | The element whose scale factor will be used to scale the value. |
value | int | The unscaled value in logical units. |
Returns
- int:
The scaled value.
ScaleLogicalValue(IDpiAwareElement, float)
Scale a value in logical units by the current DpiScaleFactor.
public static float ScaleLogicalValue(this IDpiAwareElement source, float value)
Parameter | Type | Description |
---|---|---|
source | IDpiAwareElement | The element whose scale factor will be used to scale the value. |
value | float | The unscaled value in logical units. |
Returns
- float:
The scaled value.
ScaleLogicalValue(IDpiAwareElement, Padding)
Scale a value in logical units by the current DpiScaleFactor.
public static Padding ScaleLogicalValue(this IDpiAwareElement source, Padding value)
Parameter | Type | Description |
---|---|---|
source | IDpiAwareElement | The element whose scale factor will be used to scale the value. |
value | Padding | The unscaled value in logical units. |
Returns
- Padding:
The scaled value.
SynchronizeScaleFactorWithChildren(IDpiAwareElement)
Synchronizes the DpiScaleFactor of the given element with its child elements and/or controls.
public static void SynchronizeScaleFactorWithChildren(this IDpiAwareElement source)
Parameter | Type | Description |
---|---|---|
source | IDpiAwareElement | The element to be synchronized. |