LEADTOOLS Forms (Leadtools.Forms assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
ConvertTo Method
See Also 
Leadtools.Forms Namespace > LogicalLength Structure : ConvertTo Method



sourceDpi
Represents the DPI along the length direction of the source LogicalLength. This value is only used if the source unit of measure is Leadtools.Forms.LogicalUnit.Pixel.
destinationUnit
The unit of measurement of the destination LogicalLength.
destinationDpi
Represents the DPI along the length direction of the destination LogicalLength. This value is only used if the destination unit of measure is Leadtools.Forms.LogicalUnit.Pixel.

The ConvertTo Method is available as an add-on to the LEADTOOLS Document and Medical Imaging toolkits.

sourceDpi
Represents the DPI along the length direction of the source LogicalLength. This value is only used if the source unit of measure is Leadtools.Forms.LogicalUnit.Pixel.
destinationUnit
The unit of measurement of the destination LogicalLength.
destinationDpi
Represents the DPI along the length direction of the destination LogicalLength. This value is only used if the destination unit of measure is Leadtools.Forms.LogicalUnit.Pixel.
Returns a new LogicalLength of the current (source) LogicalLength, converted to its equivalent in the specified destination unit of measure.

Syntax

Visual Basic (Declaration) 
Public Function ConvertTo( _
   ByVal sourceDpi As Double, _
   ByVal destinationUnit As LogicalUnit, _
   ByVal destinationDpi As Double _
) As LogicalLength
Visual Basic (Usage)Copy Code
Dim instance As LogicalLength
Dim sourceDpi As Double
Dim destinationUnit As LogicalUnit
Dim destinationDpi As Double
Dim value As LogicalLength
 
value = instance.ConvertTo(sourceDpi, destinationUnit, destinationDpi)
C# 
public LogicalLength ConvertTo( 
   double sourceDpi,
   LogicalUnit destinationUnit,
   double destinationDpi
)
C++/CLI 
public:
LogicalLength ConvertTo( 
   double sourceDpi,
   LogicalUnit destinationUnit,
   double destinationDpi
) 

Parameters

sourceDpi
Represents the DPI along the length direction of the source LogicalLength. This value is only used if the source unit of measure is Leadtools.Forms.LogicalUnit.Pixel.
destinationUnit
The unit of measurement of the destination LogicalLength.
destinationDpi
Represents the DPI along the length direction of the destination LogicalLength. This value is only used if the destination unit of measure is Leadtools.Forms.LogicalUnit.Pixel.

Example

This example creates a new LogicalLength structure in inches then converts it to another LogicalLength structure in pixels.

Visual BasicCopy Code
Private Sub LogicalLength_ConvertTo()
   ' create a new logical length that is 1.5 inches
   Dim lng1 As LogicalLength = New LogicalLength(1.5f, LogicalUnit.Inch)
   ' show the length
   Dim s As String = String.Format("{0}", lng1)
   MessageBox.Show(s)

   ' convert the length to pixels
   Dim lng2 As LogicalLength = lng1.ConvertTo(150, LogicalUnit.Pixel, 150)

   ' show
   s = String.Format("{0}", lng2)
   MessageBox.Show(s)
End Sub
C#Copy Code
private void LogicalLength_ConvertTo()
{
   // create a new logical length that is 1.5 inches
   LogicalLength lng1 = new LogicalLength(1.5f, LogicalUnit.Inch);
   // show the length
   string s = string.Format("{0}", lng1);
   MessageBox.Show(s);

   // convert the length to pixels
   LogicalLength lng2 = lng1.ConvertTo(150, LogicalUnit.Pixel, 150);

   // show
   s = string.Format("{0}", lng2);
   MessageBox.Show(s);
}

Remarks

The specified LogicalUnit is used to do the actual conversion.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also

Leadtools.Forms requires a Forms Module license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features