Returns a new
LogicalSize in the specified
destination unit of measure that is the equivalent of the current (source)
LogicalSize.
Syntax
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)
|
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
.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
.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
.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
.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 Basic | Copy Code |
---|
Private Sub LogicalSize_ConvertTo()
Dim sz1 As LogicalSize = New LogicalSize(1.5f, 2f, LogicalUnit.Inch)
Dim s As String = String.Format("{0}", sz1)
MessageBox.Show(s)
Dim sz2 As LogicalSize = sz1.ConvertTo(150, 150, LogicalUnit.Pixel, 150, 150)
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
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also