VisualStyleRenderer.DrawText 方法

定义

在指定边界内绘制文本。

重载

DrawText(IDeviceContext, Rectangle, String, Boolean, TextFormatFlags)

在指定边框内绘制文本,并且可以选择显示禁用的文本以及应用其他文本格式。

DrawText(IDeviceContext, Rectangle, String)

使用默认格式在指定边界内绘制文本。

DrawText(IDeviceContext, Rectangle, String, Boolean)

在指定边界内绘制文本并且可以选择显示禁用的文本。

DrawText(IDeviceContext, Rectangle, String, Boolean, TextFormatFlags)

在指定边框内绘制文本,并且可以选择显示禁用的文本以及应用其他文本格式。

public:
 void DrawText(System::Drawing::IDeviceContext ^ dc, System::Drawing::Rectangle bounds, System::String ^ textToDraw, bool drawDisabled, System::Windows::Forms::TextFormatFlags flags);
public void DrawText (System.Drawing.IDeviceContext dc, System.Drawing.Rectangle bounds, string textToDraw, bool drawDisabled, System.Windows.Forms.TextFormatFlags flags);
public void DrawText (System.Drawing.IDeviceContext dc, System.Drawing.Rectangle bounds, string? textToDraw, bool drawDisabled, System.Windows.Forms.TextFormatFlags flags);
member this.DrawText : System.Drawing.IDeviceContext * System.Drawing.Rectangle * string * bool * System.Windows.Forms.TextFormatFlags -> unit
Public Sub DrawText (dc As IDeviceContext, bounds As Rectangle, textToDraw As String, drawDisabled As Boolean, flags As TextFormatFlags)

参数

dc
IDeviceContext

用于绘制文本的 IDeviceContext

bounds
Rectangle

要在其中绘制文本的 Rectangle

textToDraw
String

要绘制的文本。

drawDisabled
Boolean

若要绘制灰显文本,则为 true;否则为 false

flags
TextFormatFlags

TextFormatFlags 值的按位组合。

例外

dcnull

适用于

DrawText(IDeviceContext, Rectangle, String)

使用默认格式在指定边界内绘制文本。

public:
 void DrawText(System::Drawing::IDeviceContext ^ dc, System::Drawing::Rectangle bounds, System::String ^ textToDraw);
public void DrawText (System.Drawing.IDeviceContext dc, System.Drawing.Rectangle bounds, string textToDraw);
public void DrawText (System.Drawing.IDeviceContext dc, System.Drawing.Rectangle bounds, string? textToDraw);
member this.DrawText : System.Drawing.IDeviceContext * System.Drawing.Rectangle * string -> unit
Public Sub DrawText (dc As IDeviceContext, bounds As Rectangle, textToDraw As String)

参数

dc
IDeviceContext

用于绘制文本的 IDeviceContext

bounds
Rectangle

要在其中绘制文本的 Rectangle

textToDraw
String

要绘制的文本。

例外

dcnull

适用于

DrawText(IDeviceContext, Rectangle, String, Boolean)

在指定边界内绘制文本并且可以选择显示禁用的文本。

public:
 void DrawText(System::Drawing::IDeviceContext ^ dc, System::Drawing::Rectangle bounds, System::String ^ textToDraw, bool drawDisabled);
public void DrawText (System.Drawing.IDeviceContext dc, System.Drawing.Rectangle bounds, string textToDraw, bool drawDisabled);
public void DrawText (System.Drawing.IDeviceContext dc, System.Drawing.Rectangle bounds, string? textToDraw, bool drawDisabled);
member this.DrawText : System.Drawing.IDeviceContext * System.Drawing.Rectangle * string * bool -> unit
Public Sub DrawText (dc As IDeviceContext, bounds As Rectangle, textToDraw As String, drawDisabled As Boolean)

参数

dc
IDeviceContext

用于绘制文本的 IDeviceContext

bounds
Rectangle

要在其中绘制文本的 Rectangle

textToDraw
String

要绘制的文本。

drawDisabled
Boolean

若要绘制灰显文本,则为 true;否则为 false

例外

dcnull

适用于