C# Class ModernWPF.DpiEvents

Show file Open project: soukoku/ModernWPF Class Usage Examples

Public Properties

Property Type Description
DpiChangeEvent System.Windows.RoutedEvent

Public Methods

Method Description
AddDpiChangeHandler ( DependencyObject element, EventHandler handler ) : void

Adds a handler to the DpiChange event.

GetWindowDpi ( DependencyObject obj ) : int

Gets the dpi value for the object contained in a window using Chrome.

GetWindowDpiScale ( DependencyObject obj ) : double

Gets the dpi scale value for the object contained in a window using Chrome.

RemoveDpiChangeHandler ( DependencyObject element, EventHandler handler ) : void

Removes a handler to the DpiChange event.

ScaleElement ( FrameworkElement child, double scaleFactor, bool compensateRender = false ) : void

Scales the element based on some factor.

Private Methods

Method Description
GetIsDpiTransform ( DependencyObject obj ) : bool
SetIsDpiTransform ( DependencyObject obj, bool value ) : void
SetWindowDpi ( DependencyObject obj, int dpi ) : void
SetWindowDpiScale ( DependencyObject obj, double dpiScale ) : void
UnwrapDpiTransform ( Transform currentTransform ) : Transform
WrapDpiTransform ( Transform origTransform, double dpiScaleFactor ) : Transform

Method Details

AddDpiChangeHandler() public static method

Adds a handler to the DpiChange event.
public static AddDpiChangeHandler ( DependencyObject element, EventHandler handler ) : void
element System.Windows.DependencyObject The element.
handler EventHandler The handler.
return void

GetWindowDpi() public static method

Gets the dpi value for the object contained in a window using Chrome.
public static GetWindowDpi ( DependencyObject obj ) : int
obj System.Windows.DependencyObject The object.
return int

GetWindowDpiScale() public static method

Gets the dpi scale value for the object contained in a window using Chrome.
public static GetWindowDpiScale ( DependencyObject obj ) : double
obj System.Windows.DependencyObject The object.
return double

RemoveDpiChangeHandler() public static method

Removes a handler to the DpiChange event.
public static RemoveDpiChangeHandler ( DependencyObject element, EventHandler handler ) : void
element System.Windows.DependencyObject The element.
handler EventHandler The handler.
return void

ScaleElement() public static method

Scales the element based on some factor.
public static ScaleElement ( FrameworkElement child, double scaleFactor, bool compensateRender = false ) : void
child System.Windows.FrameworkElement The child.
scaleFactor double The scale factor.
compensateRender bool if set to true to compensate RTL bug with render transform.
return void

Property Details

DpiChangeEvent public static property

Identifies the DpiChange event. This can only be listened to by a Window.
public static RoutedEvent,System.Windows DpiChangeEvent
return System.Windows.RoutedEvent