Converts this
LogicalSize structure to the specified unit of measure.
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
instance.Convert(sourceDpiX, sourceDpiY, destinationUnit, destinationDpiX, destinationDpiY)
|
Parameters
- sourceDpiX
-
Represents the DPI of the source value along the x-axis (width).
This value is only used if the source unit of measure is .Pixel.
- sourceDpiY
-
Represents the DPI of the source value along the y-axis (height).
This value is only used if the source unit of measure is .Pixel.
- destinationUnit
-
The unit of measurement of the destination value.
- destinationDpiX
-
Represents the DPI of the destination value along the x-axis (width). This value is only used if the source unit of measure is .Pixel.
- destinationDpiY
-
Represents the DPI of the destination value along the x-axis (width). This value is only used if the source unit of measure is .Pixel.
Example
This example creates a new LogicalSize structure in inches then converts it to pixels.
Visual Basic | Copy Code |
---|
Private Sub LogicalSize_LogicalSize()
Dim sz As LogicalSize = New LogicalSize(1.5f, 2f, LogicalUnit.Inch)
Dim s As String = String.Format("{0}", sz)
MessageBox.Show(s)
sz.Convert(150, 150, LogicalUnit.Pixel, 150, 150)
s = String.Format("{0}", sz)
MessageBox.Show(s)
End Sub |
C# | Copy Code |
---|
private void LogicalSize_LogicalSize() { // create a new logical size that is 1.5 and 2 inches LogicalSize sz = new LogicalSize(1.5f, 2f, LogicalUnit.Inch); // show the size string s = string.Format("{0}", sz); MessageBox.Show(s); // convert the size to pixels sz.Convert(150, 150, LogicalUnit.Pixel, 150, 150); // show s = string.Format("{0}", sz); 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