Gets or sets a value that represents the width for this
LogicalSize.
Syntax
Visual Basic (Declaration) | |
---|
Public Property Width As Double |
Visual Basic (Usage) | Copy Code |
---|
Dim instance As LogicalSize
Dim value As Double
instance.Width = value
value = instance.Width
|
C# | |
---|
public double Width {get; set;} |
Return Value
Value that indicates the width of the size.
Example
This example converts the width and height from inch to pixels units.
Visual Basic | Copy Code |
---|
Public Sub LogicalSize_ConvertedWidthHeight()
Dim sz As LogicalSize = New LogicalSize(1.5f, 2f, LogicalUnit.Inch)
Dim s As String
s = String.Format("Size is {0}", sz)
MessageBox.Show(s)
s = String.Format("width and height is {0}, {1} Pixels", LogicalUnitConverter.Convert(sz.Width, LogicalUnit.Inch, 150, LogicalUnit.Pixel, 150), LogicalUnitConverter.ConvertToPixels(sz.Height, LogicalUnit.Inch, 150))
MessageBox.Show(s)
End Sub |
C# | Copy Code |
---|
public void LogicalSize_ConvertedWidthHeight() { // create a new logical size with dimension of 1.5, 2 in inches LogicalSize sz = new LogicalSize(1.5f, 2f, LogicalUnit.Inch); string s; // show the size s = string.Format("Size is {0}", sz); MessageBox.Show(s); // show the width and height components converted to pixels s = string.Format("width and height is {0}, {1} Pixels", LogicalUnitConverter.Convert(sz.Width, LogicalUnit.Inch, 150, LogicalUnit.Pixel, 150), LogicalUnitConverter.ConvertToPixels(sz.Height, LogicalUnit.Inch, 150)); MessageBox.Show(s); } |
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also