Class DisplayUnitsConverter
Der Name: Aspose.Note Zusammensetzung: Aspose.Note.dll (25.4.0)
Die Klasse enthält die Methoden, um Werte zu konvertieren.
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
Vererbte Mitglieder
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Methods
InchToPoint (Float)
Umwandeln Sie Zinsen in Punkte.
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
Der Wert, um in Zoll zu konvertieren.
Returns
Das System – Single.
MillimeterToInch (Float)
Umwandelt Millimeter in Zoll.
public static float MillimeterToInch(float mm)
{
const float CONVERSION_FACTOR = 25.4f;
return mm * CONVERSION_FACTOR;
}
Parameters
mm
float
Der Wert, der in Millimetern umgewandelt wird.
Returns
Das System – Single.
MillimeterToPoint (Float)
Umwandeln Sie Millimeter in Punkte.
public static float MillimeterToPoint(float mm)
{
return mm * 25.4f;
}
Parameters
mm
float
Der Wert, der in Millimetern umgewandelt wird.
Returns
Das System – Single.
PixelToPoint (int und float)
Umwandelt Pixeln in Punkte bei der angegebenen Pixel-Resolution.
public static float PixelToPoint(int pixels, float dpi)
{
}
Parameters
pixels
int
Der Wert, der in Pixel umgewandelt wird.
dpi
float
Bildschirm auflösung.
Returns
Das System.Int32.
PointToInch (Float)
Umwandeln Sie Punkte in Inches.
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
Der Wert, der in Punkte umgewandelt wird.
Returns
Das System – Single.
PointToPixel (Float und Float)
Konvertiert Punkte zu Pixeln bei der angegebenen Pixel-Resolution.
public static int PointToPixel(float points, float dpi)
{
}
Parameters
points
float
Der Wert, der in Punkte umgewandelt wird.
dpi
float
Bildschirm auflösung.
Returns
Das System.Int32.