Click or drag to resize
CanvasTextLayoutDrawBounds Property
Gets the bounds of the parts of the text that would get drawn.

Namespace:  Microsoft.Graphics.Canvas.Text
Assembly:  Microsoft.Graphics.Canvas (in Microsoft.Graphics.Canvas.dll) Version:
public Rect DrawBounds { get; }

Property Value

Type: Rect

Draw bounds are different from layout bounds. Below, the draw bounds are outlined in green. Layout bounds are outlined in blue.

CanvasTextLayout diagram

The draw bounds are the area that is covered when you draw the text. Notice how the rectangles don't necessarily align along the top or bottom edge. And how, in some cases, the bounds may overlap each other.

The layout bounds align along the top and bottom edges, and are guaranteed never to overlap each other.

Both types of bounds are useful for different purposes. Layout bounds are useful for positioning text, aligned against an edge. Draw bounds are useful as a clip rect.

See Also