Version

CalcSize(Graphics,Font,AppearanceData,Int32,GdiDrawStringFlags) Method

Calculates the size necessary to fully display this formatted text.
Syntax
'Declaration
 
Public Overloads Function CalcSize( _
   ByVal graphics As Graphics, _
   ByVal baseFont As Font, _
   ByRef defaultAppearance As AppearanceData, _
   ByVal widthConstraint As Integer, _
   ByVal gdiDrawStringFlags As GdiDrawStringFlags _
) As Size

Parameters

graphics
Graphics object to use for text measurements.
baseFont
Base font. This is typically the font of the control. This doesn't have to take into account the font settings on the default appearance.
defaultAppearance
Default appearance. This is the appearance of parent element that will be hosting the formatted text element since appearances are inherited.
widthConstraint
The width constraint. Value of 0 means no width constraint. Note that the returned size can be bigger than the width constraint if formatted text value is as such that it requires larger area than the width constraint. For example, an image in formatted text could constraint the required minimum width necessary to display the formatted text.
gdiDrawStringFlags
GDI draw flags.

Return Value

Returns the calculated size.
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