VisualStyleRenderer.DrawText 方法

定义

在指定边界内绘制文本。Draws text in the specified bounds.

重载

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

在指定边框内绘制文本,并且可以选择显示禁用的文本以及应用其他文本格式。Draws text in the specified bounding rectangle with the option of displaying disabled text and applying other text formatting.

DrawText(IDeviceContext, Rectangle, String)

使用默认格式在指定边界内绘制文本。Draws text in the specified bounds using default formatting.

DrawText(IDeviceContext, Rectangle, String, Boolean)

在指定边界内绘制文本并且可以选择显示禁用的文本。Draws text in the specified bounds with the option of displaying disabled text.

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

在指定边框内绘制文本,并且可以选择显示禁用的文本以及应用其他文本格式。Draws text in the specified bounding rectangle with the option of displaying disabled text and applying other text formatting.

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);
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

用于绘制文本的 IDeviceContextThe IDeviceContext used to draw the text.

bounds
Rectangle

要在其中绘制文本的 RectangleA Rectangle in which to draw the text.

textToDraw
String

要绘制的文本。The text to draw.

drawDisabled
Boolean

若要绘制灰显文本,则为 true;否则为 falsetrue to draw grayed-out text; otherwise, false.

flags
TextFormatFlags

TextFormatFlags 值的按位组合。A bitwise combination of the TextFormatFlags values.

异常

dcnulldc is null.

DrawText(IDeviceContext, Rectangle, String)

使用默认格式在指定边界内绘制文本。Draws text in the specified bounds using default formatting.

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);
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

用于绘制文本的 IDeviceContextThe IDeviceContext used to draw the text.

bounds
Rectangle

要在其中绘制文本的 RectangleA Rectangle in which to draw the text.

textToDraw
String

要绘制的文本。The text to draw.

异常

dcnulldc is null.

DrawText(IDeviceContext, Rectangle, String, Boolean)

在指定边界内绘制文本并且可以选择显示禁用的文本。Draws text in the specified bounds with the option of displaying disabled text.

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);
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

用于绘制文本的 IDeviceContextThe IDeviceContext used to draw the text.

bounds
Rectangle

要在其中绘制文本的 RectangleA Rectangle in which to draw the text.

textToDraw
String

要绘制的文本。The text to draw.

drawDisabled
Boolean

若要绘制灰显文本,则为 true;否则为 falsetrue to draw grayed-out text; otherwise, false.

异常

dcnulldc is null.

适用于