In This Article

DpiAwareControl Class

A Control that listens for changes in DPI of per-monitor DPI aware applications to enable DPI awareness in versions of .NET Framework where it is not natively supported.

public class DpiAwareControl : Control, IDpiAwareElement
Inheritance:
Object Object
Derived:
StandardColorPicker NavigableSymbolSelector IntelliPromptParameterInfo IntelliPromptQuickInfo
Implements:
IDpiAwareElement

Remarks

For internal use only.

Constructors

DpiAwareControl()

Initializes a new instance of the DpiAwareControl class.

public DpiAwareControl()

Properties

DpiScaleFactor

Gets the current DPI-based scale factor to be applied when rendering the element, where Width is applied to the x-axis, and Height is applied to the y-axis.

public SizeF DpiScaleFactor { get; }

Property Value

SizeF:

A SizeF where Width is applied to the x-axis, and Height is applied to the y-axis.

See Also

Methods

DpiScaleChanged(SizeF)

Called when the DPI-based scale factor of the element changes.

protected virtual void DpiScaleChanged(SizeF scaleFactor)
Parameter Type Description
scaleFactor SizeF

The new scale factor where Width is applied to the x-axis, and Height is applied to the y-axis.

See Also

OnDpiChangedAfterParent(EventArgs)

Raises the DpiChangedAfterParent event.

protected virtual void OnDpiChangedAfterParent(EventArgs e)
Parameter Type Description
e EventArgs

The event data.

OnDpiChangedBeforeParent(EventArgs)

Raises the DpiChangedBeforeParent event.

protected virtual void OnDpiChangedBeforeParent(EventArgs e)
Parameter Type Description
e EventArgs

The event data.

OnHandleCreated(EventArgs)

Raises the HandleCreated event.

protected override void OnHandleCreated(EventArgs e)
Parameter Type Description
e EventArgs

An EventArgs that contains the event data.

RescaleConstantsForDpi(Int32, Int32)

Allows constants and other DPI-centric values to be scaled after a DPI change occurs.

protected virtual void RescaleConstantsForDpi(int deviceDpiOld, int deviceDpiNew)
Parameter Type Description
deviceDpiOld Int32

The device DPI before the change.

deviceDpiNew Int32

The device DPI after the change.

WndProc(ref Message)

Occurs when a message is sent to the control.

protected override void WndProc(ref Message m)
Parameter Type Description
m Message

Information about the message.

Events

DpiChangedAfterParent

Occurs when the DPI setting for a control is changed programmatically after the DPI of its parent control or form has changed.

public event EventHandler DpiChangedAfterParent

Event Type

EventHandler

DpiChangedBeforeParent

Occurs when the DPI setting for a control is changed programmatically before a DPI change event for its parent control or form has occurred.

public event EventHandler DpiChangedBeforeParent

Event Type

EventHandler

Explicit Interface Implementations

IDpiAwareElement.DpiScaleChanged(SizeF)

Called when the DPI-based scale factor of the element changes.

void IDpiAwareElement.DpiScaleChanged(SizeF scaleFactor)
Parameter Type Description
scaleFactor SizeF

The new scale factor where Width is applied to the x-axis, and Height is applied to the y-axis.

See Also