In This Article

DpiHelper Class

A helper class containing various procedures related to DPI-awareness.

public static class DpiHelper
Inheritance:
object object

Remarks

Scale factors are consistently represented as SizeF even when the value to be scaled does not have related x- and y-axis properties as this helps avoid integer values (like a device DPI) being accidentally passed as a float-based scale factor. When a scale value does not have related x- and y-axis properties, the SizeF.Width will define the scale to be applied.

Properties

IsDotNet6OrGreater

Tests if the current run-time environment is .NET 6 or greater.

public static bool IsDotNet6OrGreater { get; }

Property Value

bool:

true if the run-time environment is .NET 6 or greater; otherwise, false if the run-time environment is .NET Core 3.1 or .NET 5.

IsPerMonitorScalingRequired

Tests if per-monitor application scaling may be required based on DPI awareness and the current screen configuration.

public static bool IsPerMonitorScalingRequired { get; }

Property Value

bool:

true if per-monitor scaling my be required; otherwise, false.

See Also

IsPerMonitorV2Aware

Tests if the currently executing thread supports per-monitor V2 DPI awareness.

public static bool IsPerMonitorV2Aware { get; }

Property Value

bool:

true if the current context is per-monitor V2 aware; otherwise, false.

See Also

Methods

AutoScaleFont(Font, SizeF)

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(Font value, SizeF scaleFactor)
Parameter Type Description
value Font

The value to be scaled.

scaleFactor SizeF

The scale factor defined by Width.

Returns

Font:

A new Font initialized from the given font whose size has been scaled.

Remarks

This method assumes that fonts are automatically scaling to the system DPI and only per-monitor aware applications running in mixed DPI mode will have to adjust the font.

AutoScaleFont(Font, int)

Automatically rescales a font if the system DPI is different than the DPI of the device where the font will be used.

public static Font AutoScaleFont(Font value, int deviceDpi)
Parameter Type Description
value Font

The value to be scaled.

deviceDpi int

The DPI of the device where the Font will be used (e.g., 96).

Returns

Font:

A new Font initialized from the given font whose size has been scaled.

Remarks

This method assumes that fonts are automatically scaling to the system DPI and only per-monitor aware applications running in mixed DPI mode will have to adjust the font.

AutoScaleFontSize(float, SizeF)

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(float value, SizeF scaleFactor)
Parameter Type Description
value float

The value to be scaled.

scaleFactor SizeF

The scale factor defined by Width.

Returns

float:

The font size scaled, as needed, to match the DPI of the device.

Remarks

This method assumes that fonts are automatically scaling to the system DPI and only per-monitor aware applications running in mixed DPI mode will have to adjust the font.

AutoScaleFontSize(float, int)

Automatically rescales a font size if the system DPI is different than the DPI of the device where the font will be used.

public static float AutoScaleFontSize(float value, int deviceDpi)
Parameter Type Description
value float

The value to be scaled.

deviceDpi int

The DPI of the device where the Font will be used (e.g., 96).

Returns

float:

The font size scaled, as needed, to match the DPI of the device.

Remarks

This method assumes that fonts are automatically scaling to the system DPI and only per-monitor aware applications running in mixed DPI mode will have to adjust the font.

AutoScalePadding(Padding, SizeF)

Automatically rescales a Padding value if the current run-time environment does not scale Padding; otherwise, the original value is returned unscaled.

public static Padding AutoScalePadding(Padding value, SizeF scaleFactor)
Parameter Type Description
value Padding

The value to be scaled.

scaleFactor SizeF

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

Returns

Padding:

The Padding scaled, as needed, based on run-time environment support.

Remarks

This method assumes automatic scaling is applied for .NET 6 and greater. Earlier versions of .NET and all versions of .NET Framework will scale the value.

AutoScalePadding(Padding, int)

Automatically rescales a Padding value if the current run-time environment does not scale Padding; otherwise, the original value is returned unscaled.

public static Padding AutoScalePadding(Padding value, int deviceDpi)
Parameter Type Description
value Padding

The value to be scaled.

deviceDpi int

The DPI of the device (e.g., 96).

Returns

Padding:

The Padding scaled, as needed, based on run-time environment support.

Remarks

This method assumes automatic scaling is applied for .NET 6 and greater. Earlier versions of .NET and all versions of .NET Framework will scale the value.

DescaleFont(Font, SizeF)

Descales the size of a Font from the given factor.

public static Font DescaleFont(Font value, SizeF factor)
Parameter Type Description
value Font

The value to descale.

factor SizeF

The descale factor defined by Width.

Returns

Font:

A new Font initialized from the given font whose size has been descaled.

DescaleFont(Font, int)

Descales the size of a Font from the given DPI.

public static Font DescaleFont(Font value, int deviceDpi)
Parameter Type Description
value Font

The value to descale.

deviceDpi int

The DPI of the device.

Returns

Font:

A new Font initialized from the given font whose size has been descaled.

DescaleInt32(int, SizeF)

Descales an int from the given factor.

public static int DescaleInt32(int value, SizeF factor)
Parameter Type Description
value int

The value to descale.

factor SizeF

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

Returns

int:

An int adjusted from the given scale.

DescaleInt32(int, int)

Descales an int from the given DPI.

public static int DescaleInt32(int value, int deviceDpi)
Parameter Type Description
value int

The value to descale.

deviceDpi int

The DPI of the device.

Returns

int:

An int adjusted from the given DPI.

DescalePoint(Point, SizeF)

Descales a Point from the given factor.

public static Point DescalePoint(Point value, SizeF factor)
Parameter Type Description
value Point

The value to descale.

factor SizeF

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

Returns

Point:

A Point adjusted from the given scale.

DescalePoint(Point, int)

Descales a Point from the given DPI.

public static Point DescalePoint(Point value, int deviceDpi)
Parameter Type Description
value Point

The value to descale.

deviceDpi int

The DPI of the device.

Returns

Point:

A Point adjusted from the given DPI.

DescaleRectangle(Rectangle, SizeF)

Descales a Rectangle from the given factor.

public static Rectangle DescaleRectangle(Rectangle value, SizeF factor)
Parameter Type Description
value Rectangle

The value to descale.

factor SizeF

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

Returns

Rectangle:

A Rectangle adjusted from the given scale.

DescaleRectangle(Rectangle, int)

Descales a Rectangle from the given DPI.

public static Rectangle DescaleRectangle(Rectangle value, int deviceDpi)
Parameter Type Description
value Rectangle

The value to descale.

deviceDpi int

The DPI of the device.

Returns

Rectangle:

A Rectangle adjusted from the given DPI.

DescaleSingle(float, SizeF)

Descales a float from the given factor.

public static float DescaleSingle(float value, SizeF factor)
Parameter Type Description
value float

The value to descale.

factor SizeF

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

Returns

float:

A float adjusted from the given scale.

DescaleSingle(float, int)

Descales a float from the given DPI.

public static float DescaleSingle(float value, int deviceDpi)
Parameter Type Description
value float

The value to descale.

deviceDpi int

The DPI of the device.

Returns

float:

A float adjusted from the given DPI.

DescaleSize(Size, SizeF)

Descales a Size from the given factor.

public static Size DescaleSize(Size value, SizeF factor)
Parameter Type Description
value Size

The value to descale.

factor SizeF

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

Returns

Size:

A Size adjusted from the given scale.

DescaleSize(Size, int)

Descales a Size from the given DPI.

public static Size DescaleSize(Size value, int deviceDpi)
Parameter Type Description
value Size

The value to descale.

deviceDpi int

The DPI of the device.

Returns

Size:

A Size adjusted from the given DPI.

GetDefaultScaledPenWidth(SizeF)

Get the default width for a Pen scaled to the given DPI scale.

public static float GetDefaultScaledPenWidth(SizeF scaleFactor)
Parameter Type Description
scaleFactor SizeF

The scale factor (e.g., 2.0 for 200%) as defined by Width.

Returns

float:

A float adjusted to the DPI scale, or 1.0F if the scaled value was less than 1.0F.

GetDefaultScaledPenWidth(int)

Get the default width for a Pen scaled to the given DPI.

public static float GetDefaultScaledPenWidth(int deviceDpi)
Parameter Type Description
deviceDpi int

The DPI of the device.

Returns

float:

A float adjusted to the DPI, or 1.0F if the scaled value was less than 1.0F.

GetDeviceDpi(Control)

Gets the current DPI of the device where the control is currently displayed.

public static int GetDeviceDpi(Control control)
Parameter Type Description
control Control

The control to examine for DPI.

Returns

int:

The current device DPI (e.g., 96 for 100% DPI, 192 for 200% DPI).

GetDeviceDpiChangeFactor(int, int)

Gets the factor required to scale from deviceDpiOld to deviceDpiNew.

public static SizeF GetDeviceDpiChangeFactor(int deviceDpiOld, int deviceDpiNew)
Parameter Type Description
deviceDpiOld int

The DPI of the old device (e.g., 96), or 0 for the system DPI.

deviceDpiNew int

The DPI of the new device (e.g., 96), or 0 for the system DPI.

Returns

SizeF:

A SizeF whose width and height define the current DPI percentage (e.g., 1.0 for 100% DPI, 2.0 for 200% DPI) for the x- and y-axis, respectively.

GetDpiAwarenessDescription()

Gets a description of the DPI awareness context of the currently executing thread.

public static string GetDpiAwarenessDescription()

Returns

string:

A description of the DPI awareness context.

See Also

GetDpiScale(Graphics)

Gets the current DPI as a percentage.

public static SizeF GetDpiScale(Graphics g)
Parameter Type Description
g Graphics

The Graphics object to examine for DPI scale.

Returns

SizeF:

A SizeF whose width and height define the current DPI percentage (e.g., 1.0 for 100% DPI, 2.0 for 200% DPI) for the x- and y-axis, respectively.

GetDpiScale(int)

Gets the current DPI as a percentage.

public static SizeF GetDpiScale(int deviceDpi)
Parameter Type Description
deviceDpi int

The DPI of the device (e.g., 96).

Returns

SizeF:

A SizeF whose width and height define the current DPI percentage (e.g., 1.0 for 100% DPI, 2.0 for 200% DPI) for the x- and y-axis, respectively.

GetDpiScale(Control)

Gets the current DPI of the control as a percentage.

public static SizeF GetDpiScale(Control control)
Parameter Type Description
control Control

The control to examine for DPI scale.

Returns

SizeF:

A SizeF whose width and height define the current DPI percentage (e.g., 1.0 for 100% DPI, 2.0 for 200% DPI) for the x- and y-axis, respectively.

GetDpiScale(Screen)

Gets the current DPI of the screen as a percentage.

public static SizeF GetDpiScale(Screen screen)
Parameter Type Description
screen Screen

The screen to examine for DPI scale.

Returns

SizeF:

A SizeF whose width and height define the current DPI percentage (e.g., 1.0 for 100% DPI, 2.0 for 200% DPI) for the x- and y-axis, respectively.

GetScaledImage(Image, Size)

Gets an image scaled to the given size.

public static Image GetScaledImage(Image sourceImage, Size size)
Parameter Type Description
sourceImage Image

The image to scale.

size Size

The desired size of the scaled image.

Returns

Image:

A new image scaled to the given size.

GetScaledImage(Image, SizeF)

Gets an image scaled by the given factor.

public static Image GetScaledImage(Image sourceImage, SizeF scaleFactor)
Parameter Type Description
sourceImage Image

The image to scale.

scaleFactor SizeF

The scale factor; e.g., 1.25 for 125% or 2.0 for 200%.

Returns

Image:

A new image whose width and height are scaled by the given factor's width and height.

GetScaledImage(Image, int)

Gets an image scaled by the given DPI.

public static Image GetScaledImage(Image sourceImage, int deviceDpi)
Parameter Type Description
sourceImage Image

The image to scale.

deviceDpi int

The DPI of the device.

Returns

Image:

A new image scaled by the given DPI.

GetScaledImageSize(Image, SizeF)

Gets the size of an image after it is scaled.

public static Size GetScaledImageSize(Image image, SizeF scaleFactor)
Parameter Type Description
image Image

The image to examine, or null if no image is available.

scaleFactor SizeF

The scale factor to be applied.

Returns

Size:

The size of the image scaled by the given factor, or Size.Empty if no image was provided.

GetScaledImageSize(Image, SizeF, bool)

Gets the size of an image after it is scaled.

public static Size GetScaledImageSize(Image image, SizeF scaleFactor, bool allowAutoScale)
Parameter Type Description
image Image

The image to examine, or null if no image is available.

scaleFactor SizeF

The scale factor to be applied.

allowAutoScale bool

true if scaling to the device is allowed; otherwise false.

Returns

Size:

The size of the image scaled by the given factor, or Size.Empty if no image was provided.

GetScaledSystemHorizontalScrollBarArrowWidth(SizeF)

Gets the system-defined width of a horizontal scrollbar arrow for a control with the given DPI scale factor.

public static int GetScaledSystemHorizontalScrollBarArrowWidth(SizeF dpiScaleFactor)
Parameter Type Description
dpiScaleFactor SizeF

The scale factor of the control where the scrollbar will be hosted.

Returns

int:

The scaled width of a horizontal scrollbar arrow.

GetScaledSystemHorizontalScrollBarHeight(SizeF)

Gets the system-defined height of a horizontal scrollbar for a control with the given DPI scale factor.

public static int GetScaledSystemHorizontalScrollBarHeight(SizeF dpiScaleFactor)
Parameter Type Description
dpiScaleFactor SizeF

The scale factor of the control where the scrollbar will be hosted.

Returns

int:

The scaled height of a horizontal scrollbar.

GetScaledSystemVerticalScrollBarArrowHeight(SizeF)

Gets the system-defined height of a vertical scrollbar arrow for a control with the given DPI scale factor.

public static int GetScaledSystemVerticalScrollBarArrowHeight(SizeF dpiScaleFactor)
Parameter Type Description
dpiScaleFactor SizeF

The scale factor of the control where the scrollbar will be hosted.

Returns

int:

The scaled height of a vertical scrollbar arrow.

GetScaledSystemVerticalScrollBarWidth(SizeF)

Gets the system-defined width of a vertical scrollbar for a control with the given DPI scale factor.

public static int GetScaledSystemVerticalScrollBarWidth(SizeF dpiScaleFactor)
Parameter Type Description
dpiScaleFactor SizeF

The scale factor of the control where the scrollbar will be hosted.

Returns

int:

The scaled width of a vertical scrollbar.

GetScreenDeviceDpi(Point)

Gets the current DPI of the screen which contains the given location.

public static int GetScreenDeviceDpi(Point screenLocation)
Parameter Type Description
screenLocation Point

The screen location.

Returns

int:

The current device DPI (e.g., 96 for 100% DPI, 192 for 200% DPI).

Remarks

In per-monitor aware applications, this method should only be used when a window/control cannot be used.

GetScreenDeviceDpi(Screen)

Gets the current DPI of the given screen.

public static int GetScreenDeviceDpi(Screen screen)
Parameter Type Description
screen Screen

The screen to examine.

Returns

int:

The current device DPI (e.g., 96 for 100% DPI, 192 for 200% DPI).

Remarks

In per-monitor aware applications, this method should only be used when a window/control cannot be used.

GetSystemDeviceDpi()

Gets the current DPI of the default system device.

public static int GetSystemDeviceDpi()

Returns

int:

The current device DPI (e.g., 96 for 100% DPI, 192 for 200% DPI).

GetSystemDpiScale()

Gets the current DPI of the default system device as a percentage.

public static SizeF GetSystemDpiScale()

Returns

SizeF:

A SizeF whose width and height define the system DPI percentage (e.g., 1.0 for 100% DPI, 2.0 for 200% DPI) for the x- and y-axis, respectively.

RescaleFont(Font, SizeF, SizeF)

Rescales a font by changing the size relative to the scale factor.

public static Font RescaleFont(Font value, SizeF scaleFactorOld, SizeF scaleFactorNew)
Parameter Type Description
value Font

The value to be rescaled.

scaleFactorOld SizeF

The old scale factor (e.g., 2.0 or 0.5).

scaleFactorNew SizeF

The new scale factor (e.g., 2.0 or 0.5).

Returns

Font:

A new Font initialized from the given font whose size has been rescaled.

RescaleFont(Font, int, int)

Rescales a font by changing the size relative to the device DPI.

public static Font RescaleFont(Font value, int deviceDpiOld, int deviceDpiNew)
Parameter Type Description
value Font

The value to be rescaled.

deviceDpiOld int

The DPI of the old device (e.g., 96).

deviceDpiNew int

The DPI of the new device (e.g., 96).

Returns

Font:

A new Font initialized from the given font whose size has been rescaled.

RescaleInt32(int, int, int)

Rescales a int by changing the value relative to the device DPI.

public static int RescaleInt32(int value, int deviceDpiOld, int deviceDpiNew)
Parameter Type Description
value int

The value to rescaled.

deviceDpiOld int

The DPI of the old device (e.g., 96).

deviceDpiNew int

The DPI of the new device (e.g., 96).

Returns

int:

A int adjusted to the device DPI.

RescaleListViewColumns(ListView, int, int)

Rescales the Width for each column in a ListView by changing the value relative to the device DPI.

public static void RescaleListViewColumns(ListView listView, int deviceDpiOld, int deviceDpiNew)
Parameter Type Description
listView ListView

The ListView whose columns will be rescaled.

deviceDpiOld int

The DPI of the old device (e.g., 96).

deviceDpiNew int

The DPI of the new device (e.g., 96).

RescalePoint(Point, int, int)

Rescales a Point by changing the value relative to the device DPI.

public static Point RescalePoint(Point value, int deviceDpiOld, int deviceDpiNew)
Parameter Type Description
value Point

The value to rescaled.

deviceDpiOld int

The DPI of the old device (e.g., 96).

deviceDpiNew int

The DPI of the new device (e.g., 96).

Returns

Point:

A Point adjusted to the device DPI.

RescaleRectangle(Rectangle, int, int)

Rescales a Rectangle by changing the value relative to the device DPI.

public static Rectangle RescaleRectangle(Rectangle value, int deviceDpiOld, int deviceDpiNew)
Parameter Type Description
value Rectangle

The value to rescaled.

deviceDpiOld int

The DPI of the old device (e.g., 96).

deviceDpiNew int

The DPI of the new device (e.g., 96).

Returns

Rectangle:

A Point adjusted to the device DPI.

RescaleSingle(float, int, int)

Rescales a float by changing the value relative to the device DPI.

public static float RescaleSingle(float value, int deviceDpiOld, int deviceDpiNew)
Parameter Type Description
value float

The value to rescaled.

deviceDpiOld int

The DPI of the old device (e.g., 96).

deviceDpiNew int

The DPI of the new device (e.g., 96).

Returns

float:

A float adjusted to the device DPI.

RescaleSize(Size, int, int)

Rescales a Size by changing the value relative to the device DPI.

public static Size RescaleSize(Size value, int deviceDpiOld, int deviceDpiNew)
Parameter Type Description
value Size

The value to rescaled.

deviceDpiOld int

The DPI of the old device (e.g., 96).

deviceDpiNew int

The DPI of the new device (e.g., 96).

Returns

Size:

A Size adjusted to the device DPI.

ScaleFactorToDeviceDpi(SizeF)

Converts a DPI scale factor into the equivalent device DPI.

public static int ScaleFactorToDeviceDpi(SizeF factor)
Parameter Type Description
factor SizeF

The scale factor defined by Width.

Returns

int:

The equivalent device DPI for the scale factor.

ScaleInt32(int, SizeF)

Scales an int by a given factor.

public static int ScaleInt32(int value, SizeF factor)
Parameter Type Description
value int

The value to scale.

factor SizeF

The scale factor defined by Width.

Returns

int:

An int adjusted to the given scale.

ScaleInt32(int, int)

Scales an int for the given DPI.

public static int ScaleInt32(int value, int deviceDpi)
Parameter Type Description
value int

The value to scale.

deviceDpi int

The DPI of the device.

Returns

int:

An int adjusted to the given DPI.

ScalePadding(Padding, SizeF)

Scales a Padding by a given factor.

public static Padding ScalePadding(Padding value, SizeF factor)
Parameter Type Description
value Padding

The value to scale.

factor SizeF

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

Returns

Padding:

A Padding adjusted to the given scale.

ScalePadding(Padding, int)

Scales a Padding by the given DPI.

public static Padding ScalePadding(Padding value, int deviceDpi)
Parameter Type Description
value Padding

The value to scale.

deviceDpi int

The DPI of the device.

Returns

Padding:

A Padding adjusted to the given DPI.

ScalePadding(Padding, SizeF)

Scales a Padding by a given factor.

public static Padding ScalePadding(Padding value, SizeF factor)
Parameter Type Description
value Padding

The value to scale.

factor SizeF

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

Returns

Padding:

A Padding adjusted to the given scale.

ScalePadding(Padding, int)

Scales a Padding by the given DPI.

public static Padding ScalePadding(Padding value, int deviceDpi)
Parameter Type Description
value Padding

The value to scale.

deviceDpi int

The DPI of the device.

Returns

Padding:

A Padding adjusted to the given DPI.

ScalePenWidth(float, SizeF)

Scales the width for a Pen to the given scale.

public static float ScalePenWidth(float value, SizeF factor)
Parameter Type Description
value float

The value to scale.

factor SizeF

The scale factor (e.g., 2.0 or 0.5) as defined by Width.

Returns

float:

A float adjusted to the given scale, or 1.0F if the scaled value was less than 1.0F.

ScalePenWidth(float, int)

Scales the width for a Pen to the given scale.

public static float ScalePenWidth(float value, int deviceDpi)
Parameter Type Description
value float

The value to scale.

deviceDpi int

The DPI of the device.

Returns

float:

A float adjusted to the given DPI, or 1.0F if the scaled value was less than 1.0F.

ScalePoint(Point, SizeF)

Scales a Point by a given factor.

public static Point ScalePoint(Point value, SizeF factor)
Parameter Type Description
value Point

The value to scale.

factor SizeF

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

Returns

Point:

A Point adjusted to the given scale.

ScalePoint(Point, int)

Scales a Point to the given DPI.

public static Point ScalePoint(Point value, int deviceDpi)
Parameter Type Description
value Point

The value to scale.

deviceDpi int

The device DPI.

Returns

Point:

A Point adjusted to the given DPI.

ScaleRectangle(Rectangle, SizeF)

Scales a Rectangle by a given factor.

public static Rectangle ScaleRectangle(Rectangle value, SizeF factor)
Parameter Type Description
value Rectangle

The value to scale.

factor SizeF

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

Returns

Rectangle:

A Rectangle adjusted to the given scale.

ScaleRectangle(Rectangle, int)

Scales a Rectangle to the given DPI.

public static Rectangle ScaleRectangle(Rectangle value, int deviceDpi)
Parameter Type Description
value Rectangle

The value to scale.

deviceDpi int

The DPI of the device.

Returns

Rectangle:

A Rectangle adjusted to the given DPI.

ScaleSingle(float, SizeF)

Scales a float by a given factor.

public static float ScaleSingle(float value, SizeF factor)
Parameter Type Description
value float

The value to scale.

factor SizeF

The scale factor defined by Width.

Returns

float:

A float adjusted to the given scale.

ScaleSingle(float, int)

Scales a float to the given DPI.

public static float ScaleSingle(float value, int deviceDpi)
Parameter Type Description
value float

The value to scale.

deviceDpi int

The DPI of the device.

Returns

float:

A float adjusted to the given DPI.

ScaleSize(Size, SizeF)

Scales a Size by a given factor.

public static Size ScaleSize(Size value, SizeF factor)
Parameter Type Description
value Size

The value to scale.

factor SizeF

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

Returns

Size:

A Size adjusted to the given scale.

ScaleSize(Size, int)

Scales a Size to the given DPI.

public static Size ScaleSize(Size value, int deviceDpi)
Parameter Type Description
value Size

The value to scale.

deviceDpi int

The DPI of the device.

Returns

Size:

A Size adjusted to the given DPI.

ScaleSizeF(SizeF, SizeF)

Scales a SizeF by a given factor.

public static SizeF ScaleSizeF(SizeF value, SizeF factor)
Parameter Type Description
value SizeF

The value to scale.

factor SizeF

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

Returns

SizeF:

A Size adjusted to the given scale.

ScaleSizeF(SizeF, int)

Scales a SizeF to the given DPI.

public static SizeF ScaleSizeF(SizeF value, int deviceDpi)
Parameter Type Description
value SizeF

The value to scale.

deviceDpi int

The DPI of the device.

Returns

SizeF:

A SizeF adjusted to the given DPI.

Fields

DefaultDeviceDpi

The default device DPI.

public const int DefaultDeviceDpi = 96

Inherited Members