Version

GetLabelSizePixels(String,LabelStyle) Method

Gets the size of a specified string using a specified LabelStyle.
Syntax
'Declaration
 
Public Overloads Shared Function GetLabelSizePixels( _
   ByVal str As String, _
   ByVal style As LabelStyle _
) As SizeF
public static SizeF GetLabelSizePixels( 
   string str,
   LabelStyle style
)

Parameters

str
The string to measure.
style
The LabelStyle object to use when measuring this string.

Return Value

A SizeF object containing the height and width of the label.
Remarks

Unlike the GetStringSizePixels method, this method accounts for the Orientation property of the given LabelStyle object, which affects how high or wide a label will be.

For example, a string+font measured at 50x100 pixels (HxW), but oriented vertically, would yield a SizeF of 100x50 using this method.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also