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, Single)
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 | Single | The value to be scaled. |
Returns
- Single:
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, Int32)
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 | Int32 | The unscaled value in logical units. |
Returns
- Int32:
The scaled value.
ScaleLogicalValue(IDpiAwareElement, Single)
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 | Single | The unscaled value in logical units. |
Returns
- Single:
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. |
Inherited Members
- Object.ToString()
- Object.Equals(Object)
- Object.Equals(Object, Object)
- Object.ReferenceEquals(Object, Object)
- Object.GetHashCode()
- Object.GetType()
- System.Object.MemberwiseClone()