Class MeasureUnitsConverter
The UnitsConverter class helps convert different metrics units. Conversion is based on Graphics object DPI settings. Handles cases such as printers often having 300 and greater dpi resolution, while the default screen dpi is 96.
Inheritance
Inherited Members
Namespace: Syncfusion.Windows.Forms.Diagram
Assembly: Syncfusion.Diagram.Base.dll
Syntax
public class MeasureUnitsConverter
Constructors
MeasureUnitsConverter()
Declaration
public MeasureUnitsConverter()
Fields
s_fPrevDpiX
Declaration
public static float s_fPrevDpiX
Field Value
Type |
---|
System.Single |
s_fPrevDpiY
Declaration
public static float s_fPrevDpiY
Field Value
Type |
---|
System.Single |
Properties
DpiX
Gets or sets the dot per inch value by X axis.
Declaration
public static float DpiX { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The dpi X. |
DpiY
Gets or sets the dot per inch value by Y axis.
Declaration
public static float DpiY { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The dpi Y. |
MeasureUnitAbbreviation
Gets the measure unit abbreviations.
Declaration
public static string[] MeasureUnitAbbreviation { get; }
Property Value
Type | Description |
---|---|
System.String[] | The measure unit abbreviations. |
Methods
Convert(PointF, MeasureUnits, MeasureUnits)
Converts value, stored in "from" units, to value in "to" units
Declaration
public static PointF Convert(PointF value, MeasureUnits from, MeasureUnits to)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | value | Value to convert |
MeasureUnits | from | Indicates units to convert from |
MeasureUnits | to | Indicates units to convert to |
Returns
Type | Description |
---|---|
System.Drawing.PointF | Value stored in "to" units |
Convert(RectangleF, MeasureUnits, MeasureUnits)
Converts value, stored in "from" units, to value in "to" units
Declaration
public static RectangleF Convert(RectangleF value, MeasureUnits from, MeasureUnits to)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | value | Value to convert |
MeasureUnits | from | Indicates units to convert from |
MeasureUnits | to | Indicates units to convert to |
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | Value stored in "to" units |
Convert(SizeF, MeasureUnits, MeasureUnits)
Converts value, stored in "from" units, to value in "to" units
Declaration
public static SizeF Convert(SizeF value, MeasureUnits from, MeasureUnits to)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.SizeF | value | Value to convert |
MeasureUnits | from | Indicates units to convert from |
MeasureUnits | to | Indicates units to convert to |
Returns
Type | Description |
---|---|
System.Drawing.SizeF | Value stored in "to" units |
Convert(Single, MeasureUnits, MeasureUnits)
Converts value, stored in "from" units, to value in "to" units
Declaration
public static float Convert(float value, MeasureUnits from, MeasureUnits to)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value | Value to convert |
MeasureUnits | from | Indicates units to convert from |
MeasureUnits | to | Indicates units to convert to |
Returns
Type | Description |
---|---|
System.Single | Value stored in "to" units |
ConvertX(Single, MeasureUnits, MeasureUnits)
Converts value, stored in "from" units, to value in "to" units
Declaration
public static float ConvertX(float value, MeasureUnits from, MeasureUnits to)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value | Value to convert |
MeasureUnits | from | Indicates units to convert from |
MeasureUnits | to | Indicates units to convert to |
Returns
Type | Description |
---|---|
System.Single | Value stored in "to" units |
ConvertY(Single, MeasureUnits, MeasureUnits)
Converts value, stored in "from" units, to value in "to" units
Declaration
public static float ConvertY(float value, MeasureUnits from, MeasureUnits to)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value | Value to convert |
MeasureUnits | from | Indicates units to convert from |
MeasureUnits | to | Indicates units to convert to |
Returns
Type | Description |
---|---|
System.Single | Value stored in "to" units |
FromPixels(PointF, MeasureUnits)
Convert rectangle from pixels to specified units
Declaration
public static PointF FromPixels(PointF point, MeasureUnits to)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | point | point in pixels units |
MeasureUnits | to | convert to units |
Returns
Type | Description |
---|---|
System.Drawing.PointF | output Point in specified units |
FromPixels(RectangleF, MeasureUnits)
Convert rectangle in Pixels into rectangle with specified measure units
Declaration
public static RectangleF FromPixels(RectangleF rect, MeasureUnits to)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rect | source rectangle in pixels units |
MeasureUnits | to | convert to units |
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | output Rectangle in specified units |
FromPixels(SizeF, MeasureUnits)
Convert Size in pixels to size in specified measure units
Declaration
public static SizeF FromPixels(SizeF size, MeasureUnits to)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.SizeF | size | source size |
MeasureUnits | to | convert to units |
Returns
Type | Description |
---|---|
System.Drawing.SizeF | output size in specified measure units |
FromPixelX(Single, MeasureUnits)
Converts value, stored in pixels, to value in "to" units
Declaration
public static float FromPixelX(float value, MeasureUnits to)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value | Value to convert |
MeasureUnits | to | Indicates units to convert to |
Returns
Type | Description |
---|---|
System.Single | Value stored in "to" units |
FromPixelY(Single, MeasureUnits)
Converts value, stored in pixels, to value in "to" units
Declaration
public static float FromPixelY(float value, MeasureUnits to)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value | Value to convert |
MeasureUnits | to | Indicates units to convert to |
Returns
Type | Description |
---|---|
System.Single | Value stored in "to" units |
GetAbbreviation(MeasureUnits)
Gets the measure unit abbreviation.
Declaration
public static string GetAbbreviation(MeasureUnits units)
Parameters
Type | Name | Description |
---|---|---|
MeasureUnits | units | The measure units. |
Returns
Type | Description |
---|---|
System.String | Abbreviated string. |
GetMeasureUnit(String, out MeasureUnits)
Gets the measure unit from abbreviation.
Declaration
public static bool GetMeasureUnit(string strAbbreviation, out MeasureUnits units)
Parameters
Type | Name | Description |
---|---|---|
System.String | strAbbreviation | The measure unit abbreviation. |
MeasureUnits | units | The units. |
Returns
Type | Description |
---|---|
System.Boolean | true, if get measure unit. |
ToPixels(PointF, MeasureUnits)
Convert point from specified measure units to pixels
Declaration
public static PointF ToPixels(PointF point, MeasureUnits from)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | point | source point for convert |
MeasureUnits | from | measure units |
Returns
Type | Description |
---|---|
System.Drawing.PointF | point in pixels coordinates |
ToPixels(RectangleF, MeasureUnits)
Convert rectangle location and size to Pixels from specified measure units
Declaration
public static RectangleF ToPixels(RectangleF rect, MeasureUnits from)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rect | source rectangle |
MeasureUnits | from | source rectangle measure units |
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | Rectangle with Pixels |
ToPixels(SizeF, MeasureUnits)
Convert size from specified measure units to pixels
Declaration
public static SizeF ToPixels(SizeF size, MeasureUnits from)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.SizeF | size | source size |
MeasureUnits | from | measure units |
Returns
Type | Description |
---|---|
System.Drawing.SizeF | size in pixels |
ToPixelX(Single, MeasureUnits)
Converts value, stored in "from" units, to pixels
Declaration
public static float ToPixelX(float value, MeasureUnits from)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value | Value to convert |
MeasureUnits | from | Indicates units to convert from |
Returns
Type | Description |
---|---|
System.Single | Value stored in pixels |
ToPixelY(Single, MeasureUnits)
Converts value, stored in "from" units, to pixels
Declaration
public static float ToPixelY(float value, MeasureUnits from)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value | Value to convert |
MeasureUnits | from | Indicates units to convert from |
Returns
Type | Description |
---|---|
System.Single | Value stored in pixels |