Edit

Share via


VisualStyleRenderer.DrawText Method

Definition

Draws text in the specified bounds.

Overloads

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

Parameters

dc
IDeviceContext

The IDeviceContext used to draw the text.

bounds
Rectangle

A Rectangle in which to draw the text.

textToDraw
String

The text to draw.

drawDisabled
Boolean

true to draw grayed-out text; otherwise, false.

flags
TextFormatFlags

A bitwise combination of the TextFormatFlags values.

Exceptions

dc is null.

Applies to

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

Parameters

dc
IDeviceContext

The IDeviceContext used to draw the text.

bounds
Rectangle

A Rectangle in which to draw the text.

textToDraw
String

The text to draw.

Exceptions

dc is null.

Applies to

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

Parameters

dc
IDeviceContext

The IDeviceContext used to draw the text.

bounds
Rectangle

A Rectangle in which to draw the text.

textToDraw
String

The text to draw.

drawDisabled
Boolean

true to draw grayed-out text; otherwise, false.

Exceptions

dc is null.

Applies to