共用方式為


ICanvas.DrawString 方法

定義

多載

DrawString(String, Single, Single, HorizontalAlignment)

將文字字串繪製到畫布上。

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

將周框方塊內的文字字串繪製到畫布上。

DrawString(String, Single, Single, HorizontalAlignment)

來源:
ICanvas.cs
來源:
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)

來源:
ICanvas.cs
來源:
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。

適用於