Share via


ICanvas.DrawString Method

Definition

Overloads

DrawString(String, Single, Single, HorizontalAlignment)

Draws a text string onto the canvas.

DrawString(String, Single, Single, Single, Single, HorizontalAlignment, VerticalAlignment, TextFlow, Single)

Draws a text string within a bounding box onto the canvas.

DrawString(String, Single, Single, HorizontalAlignment)

Source:
ICanvas.cs
Source:
ICanvas.cs

Draws a text string onto the canvas.

public:
 void DrawString(System::String ^ value, float x, float y, Microsoft::Maui::Graphics::HorizontalAlignment horizontalAlignment);
public void DrawString (string value, float x, float y, Microsoft.Maui.Graphics.HorizontalAlignment horizontalAlignment);
abstract member DrawString : string * single * single * Microsoft.Maui.Graphics.HorizontalAlignment -> unit
Public Sub DrawString (value As String, x As Single, y As Single, horizontalAlignment As HorizontalAlignment)

Parameters

value
String

Text to be displayed.

x
Single

Starting x coordinate.

y
Single

Starting y coordinate.

horizontalAlignment
HorizontalAlignment

Horizontal alignment options to align the string.

Remarks

To draw attributed text, use DrawText(IAttributedText, Single, Single, Single, Single) instead.

Applies to

DrawString(String, Single, Single, Single, Single, HorizontalAlignment, VerticalAlignment, TextFlow, Single)

Source:
ICanvas.cs
Source:
ICanvas.cs

Draws a text string within a bounding box onto the canvas.

public void DrawString (string value, float x, float y, float width, float height, Microsoft.Maui.Graphics.HorizontalAlignment horizontalAlignment, Microsoft.Maui.Graphics.VerticalAlignment verticalAlignment, Microsoft.Maui.Graphics.TextFlow textFlow = Microsoft.Maui.Graphics.TextFlow.ClipBounds, float lineSpacingAdjustment = 0);
abstract member DrawString : string * single * single * single * single * Microsoft.Maui.Graphics.HorizontalAlignment * Microsoft.Maui.Graphics.VerticalAlignment * Microsoft.Maui.Graphics.TextFlow * single -> unit
Public Sub DrawString (value As String, x As Single, y As Single, width As Single, height As Single, horizontalAlignment As HorizontalAlignment, verticalAlignment As VerticalAlignment, Optional textFlow As TextFlow = Microsoft.Maui.Graphics.TextFlow.ClipBounds, Optional lineSpacingAdjustment As Single = 0)

Parameters

value
String

Text to be displayed.

x
Single

Starting x coordinate of the bounding box.

y
Single

Starting y coordinate of the bounding box.

width
Single

Width of the bounding box.

height
Single

Height of the bounding box.

horizontalAlignment
HorizontalAlignment

Horizontal alignment options to align the string within the bounding box.

verticalAlignment
VerticalAlignment

Vertical alignment options to align the string within the bounding box.

textFlow
TextFlow

Specifies whether text will be clipped in case it overflows the bounding box. Default is ClipBounds.

lineSpacingAdjustment
Single

Spacing adjustment between lines. Default is 0.

Applies to