←Select platform

ConvertTo Method

Summary

Returns a new LogicalLength of the current (source) LogicalLength, converted to its equivalent in the specified destination unit of measure.

Syntax

C#
VB
C++
  
Public Function ConvertTo( _ 
   ByVal sourceDpi As Double, _ 
   ByVal destinationUnit As Leadtools.Forms.LogicalUnit, _ 
   ByVal destinationDpi As Double _ 
) As Leadtools.Forms.LogicalLength 

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.

Remarks

The specified LogicalUnit is used to do the actual conversion.

Example

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

C#
VB
using Leadtools.Forms; 
 
public 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); 
} 
Imports Leadtools.Forms 
 
Public 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 

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Forms Assembly