Class DisplayUnitsConverter
Class DisplayUnitsConverter
名称: Aspose.Note 集合: Aspose.Note.dll (25.4.0)
类包含转换值的方法。
public static class DisplayUnitsConverter
{
public static double Convert(double value, DisplayUnits from, DisplayUnits to)
{
switch (from)
{
case DisplayUnits.Millimeters:
return ToCentimeters(value) * ToMeters(100) * ToKilometers(100000);
case DisplayUnits.Centimeters:
return value * ToMeters(100) * ToKilometers(100000);
case DisplayUnits.Meters:
return value * ToKilometers(1000);
default:
throw new ArgumentException("Invalid input unit");
}
double ToMillimeters(double value) => value * 10;
double ToCentimeters(double value) => value / 10;
double ToMeters(double value) => value / 100;
double ToKilometers(double value) => value / 1000;
}
}
Inheritance
object ← DisplayUnitsConverter
继承人
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Methods
InchToPoint(浮动)
将英寸转换为点。
public static float InchToPoint(float inches)
{
}
In this case, since there are no nested structures or complex conditions in the provided code snippet, the output remains the same as the input. For more complex scenarios, proper indentation will be applied according to standard C# conventions.
Parameters
inches
float
转换为英寸的值。
Returns
系统 - 单一
英寸(表面)
将毫米转换为英寸。
public static float MillimeterToInch(float mm)
{
const float CONVERSION_FACTOR = 25.4f;
return mm * CONVERSION_FACTOR;
}
Parameters
mm
float
将值转换为毫米。
Returns
系统 - 单一
千米(Float)
将毫米转换为点。
public static float MillimeterToPoint(float mm)
{
return mm * 25.4f;
}
Parameters
mm
float
将值转换为毫米。
Returns
系统 - 单一
PixelToPoint(英格兰,浮动)
将像素转换为点,在指定的 pixel 分辨率。
public static float PixelToPoint(int pixels, float dpi)
{
}
Parameters
pixels
int
将值转换为像素。
dpi
float
屏幕分辨率。
Returns
此分類上一篇: Int32
PointToInch(船舶)
将点转换为英寸。
public static float PointToInch(float points)
{
}
Here's a version with consistent spacing and indentation according to standard C# conventions:
public static float PointToInch(float points)
{
}
Parameters
points
float
将值转换为点。
Returns
系统 - 单一
PointToPixel(浮,浮)
将点转换为在指定的像素分辨率的Pixel。
public static int PointToPixel(float points, float dpi)
{
}
Parameters
points
float
将值转换为点。
dpi
float
屏幕分辨率。
Returns
此分類上一篇: Int32