ICanvas.DrawString 方法

定义

重载

DrawString(String, Single, Single, HorizontalAlignment)

将文本字符串绘制到画布上。

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

将边界框中的文本字符串绘制到画布上。

DrawString(String, Single, Single, HorizontalAlignment)

Source:
ICanvas.cs
Source:
ICanvas.cs

将文本字符串绘制到画布上。

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)

参数

value
String

要显示的文本。

x
Single

起始 x 坐标。

y
Single

起始 y 坐标。

horizontalAlignment
HorizontalAlignment

用于对齐字符串的水平对齐选项。

注解

若要绘制特性化文本,请改用 DrawText(IAttributedText, Single, Single, Single, Single)

适用于

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

Source:
ICanvas.cs
Source:
ICanvas.cs

将边界框中的文本字符串绘制到画布上。

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)

参数

value
String

要显示的文本。

x
Single

x边界框的起始坐标。

y
Single

y边界框的起始坐标。

width
Single

边界框的宽度。

height
Single

边界框的高度。

horizontalAlignment
HorizontalAlignment

水平对齐选项,用于对齐边界框中的字符串。

verticalAlignment
VerticalAlignment

垂直对齐选项,用于对齐边界框中的字符串。

textFlow
TextFlow

指定在文本溢出边界框时是否将被剪裁。 默认值为 ClipBounds

lineSpacingAdjustment
Single

行之间的间距调整。 默认为 0。

适用于