Gets an array of Region objects, each of which bounds a range of character positions within the specified string.
Assembly: System.Drawing (in System.Drawing.dll)
member MeasureCharacterRanges : text:string * font:Font * layoutRect:RectangleF * stringFormat:StringFormat -> Region
- Type: System.String
String to measure.
- Type: System.Drawing.RectangleF
RectangleF structure that specifies the layout rectangle for the string.
Sets a string "First and Second ranges" and a font for display of the string ("Times New Roman", 16 point).
Sets two character ranges within the string (which correspond to the words "First" and "Second").
Creates a rectangle in which to display the string.
Sets the formatting of the string ¾ including the two character ranges.
Draws the string to the screen.
Measures the character ranges, determines rectangles that bound the two specified ranges.
Draws the two rectangles to the screen.
The result is the displayed string with the first range ("First") bounded by a red rectangle and the second range ("Second") bounded by a blue rectangle.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.