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 > LogicalSize Structure : ConvertTo Method



sourceDpiX
Represents the DPI along the x-axis (Width) of the source LogicalSize. This value is only used if the source unit of measure is Leadtools.Forms.LogicalUnit.Pixel
sourceDpiY
Represents the DPI along the y-axis (Height) of the source LogicalSize. This value is only used if the source unit of measure is Leadtools.Forms.LogicalUnit.Pixel.
destinationUnit
The unit of measurement of the destination LogicalSize.
destinationDpiX
Represents the DPI along the x-axis (Width) of the destination LogicalSize. This value is only used if the destination unit of measure is Leadtools.Forms.LogicalUnit.Pixel.
destinationDpiY
Represents the DPI along the y-axis (Height) of the destination LogicalSize. This value is only used if the destination unit of measure is Leadtools.Forms.LogicalUnit.Pixel.
sourceDpiX
Represents the DPI along the x-axis (Width) of the source LogicalSize. This value is only used if the source unit of measure is Leadtools.Forms.LogicalUnit.Pixel
sourceDpiY
Represents the DPI along the y-axis (Height) of the source LogicalSize. This value is only used if the source unit of measure is Leadtools.Forms.LogicalUnit.Pixel.
destinationUnit
The unit of measurement of the destination LogicalSize.
destinationDpiX
Represents the DPI along the x-axis (Width) of the destination LogicalSize. This value is only used if the destination unit of measure is Leadtools.Forms.LogicalUnit.Pixel.
destinationDpiY
Represents the DPI along the y-axis (Height) of the destination LogicalSize. This value is only used if the destination unit of measure is Leadtools.Forms.LogicalUnit.Pixel.
Returns a new LogicalSize in the specified destination unit of measure that is the equivalent of the current (source) LogicalSize.

Syntax

Visual Basic (Declaration) 
Public Function ConvertTo( _
   ByVal sourceDpiX As Double, _
   ByVal sourceDpiY As Double, _
   ByVal destinationUnit As LogicalUnit, _
   ByVal destinationDpiX As Double, _
   ByVal destinationDpiY As Double _
) As LogicalSize
Visual Basic (Usage)Copy Code
Dim instance As LogicalSize
Dim sourceDpiX As Double
Dim sourceDpiY As Double
Dim destinationUnit As LogicalUnit
Dim destinationDpiX As Double
Dim destinationDpiY As Double
Dim value As LogicalSize
 
value = instance.ConvertTo(sourceDpiX, sourceDpiY, destinationUnit, destinationDpiX, destinationDpiY)
C++/CLI 
public:
LogicalSize ConvertTo( 
   double sourceDpiX,
   double sourceDpiY,
   LogicalUnit destinationUnit,
   double destinationDpiX,
   double destinationDpiY
) 

Parameters

sourceDpiX
Represents the DPI along the x-axis (Width) of the source LogicalSize. This value is only used if the source unit of measure is Leadtools.Forms.LogicalUnit.Pixel
sourceDpiY
Represents the DPI along the y-axis (Height) of the source LogicalSize. This value is only used if the source unit of measure is Leadtools.Forms.LogicalUnit.Pixel.
destinationUnit
The unit of measurement of the destination LogicalSize.
destinationDpiX
Represents the DPI along the x-axis (Width) of the destination LogicalSize. This value is only used if the destination unit of measure is Leadtools.Forms.LogicalUnit.Pixel.
destinationDpiY
Represents the DPI along the y-axis (Height) of the destination LogicalSize. This value is only used if the destination unit of measure is Leadtools.Forms.LogicalUnit.Pixel.

Return Value

A new LogicalSize in the specified destination unit of measure that is the equivalent of the current (source) LogicalSize.

Example

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

Visual BasicCopy Code
Private Sub LogicalSize_ConvertTo()
   ' create a new logical size that is 1.5 and 2 inches
   Dim sz1 As LogicalSize = New LogicalSize(1.5f, 2f, LogicalUnit.Inch)
   ' show the size
   Dim s As String = String.Format("{0}", sz1)
   MessageBox.Show(s)

   ' convert the size to pixels
   Dim sz2 As LogicalSize = sz1.ConvertTo(150, 150, LogicalUnit.Pixel, 150, 150)

   ' show
   s = String.Format("{0}", sz2)
   MessageBox.Show(s)
End Sub
C#Copy Code
private void LogicalSize_ConvertTo()
{
   // create a new logical size that is 1.5 and 2 inches
   LogicalSize sz1 = new LogicalSize(1.5f, 2f, LogicalUnit.Inch);
   // show the size
   string s = string.Format("{0}", sz1);
   MessageBox.Show(s);

   // convert the size to pixels
   LogicalSize sz2 = sz1.ConvertTo(150, 150, LogicalUnit.Pixel, 150, 150);

   // show
   s = string.Format("{0}", sz2);
   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