Table of Contents

Class DpiHelper

Namespace
LightningChartLib.WinForms.Charting
Assembly
LightningChart.WinForms.Charting.NET4.dll

Static helper class that contains helpers on DPI related issues. Meaning mainly PX to DIP conversions.

public static class DpiHelper
Inheritance
DpiHelper
Inherited Members

Properties

DpiAware

Defines if the system process is DPI aware or not. Currently there is no way distinguishing between system aware and Per-monitor aware.

public static bool DpiAware { get; }

Property Value

bool

DpiXFactor

Effective Zoom factor of the system DPI of the screen width. Factor that describes how many real pixels there are per one DIP in X direction.

public static float DpiXFactor { get; }

Property Value

float

DpiYFactor

Effective Zoom factor of the system DPI of the screen height. Factor that describes how many real pixels there are per one DIP in Y direction.

public static float DpiYFactor { get; }

Property Value

float

Methods

DipToPx(double, bool)

Converts given DIP (Device Independent Pixels) values to PX (Screen pixels) using system DPI settings.

public static double DipToPx(double DIP, bool UseXDirection = true)

Parameters

DIP double

Value to convert in DIPs

UseXDirection bool

If true, the screen width direction DPI factor is used. Height direction otherwise

Returns

double

Converted value in PX.

Remarks

The UseXDirection has default value of true as the width and height direction DPI factors are usually the same.

DipToPx(ref RectangleF)

Converts given rectangle size and position defined in DIP (Device Independent Pixels) to PX (Screen pixels) values using system DPI settings.

public static void DipToPx(ref RectangleF PX)

Parameters

PX RectangleF

Rectangle to convert / modify, defined in DIPs.

DipToPx(float, bool)

Converts given DIP (Device Independent Pixels) values to PX (Screen pixels) using system DPI settings.

public static float DipToPx(float DIP, bool UseXDirection = true)

Parameters

DIP float

Value to convert in DIPs

UseXDirection bool

If true, the screen width direction DPI factor is used. Height direction otherwise

Returns

float

Converted value in PX.

Remarks

The UseXDirection has default value of true as the width and height direction DPI factors are usually the same.

PxToDip(double, bool)

Converts given PX (Screen pixels) to DIP (Device Independent Pixels) values using system DPI settings.

public static double PxToDip(double PX, bool UseXDirection = true)

Parameters

PX double

Value to convert in pixels.

UseXDirection bool

If true, the screen width direction DPI factor is used. Height direction otherwise

Returns

double

Converted value in DPIs.

Remarks

The UseXDirection has default value of true as the width and height direction DPI factors are usually the same.

PxToDip(float, bool)

Converts given PX (Screen pixels) to DIP (Device Independent Pixels) values using system DPI settings.

public static float PxToDip(float PX, bool UseXDirection = true)

Parameters

PX float

Value to convert in pixels.

UseXDirection bool

If true, the screen width direction DPI factor is used. Height direction otherwise

Returns

float

Converted value in DPIs.

Remarks

The UseXDirection has default value of true as the width and height direction DPI factors are usually the same.