Bewerken

Delen via


VisualStyleRenderer.GetTextExtent Method

Definition

Returns the size and location of the specified string when drawn with the font of the current visual style element.

Overloads

GetTextExtent(IDeviceContext, String, TextFormatFlags)

Returns the size and location of the specified string when drawn with the font of the current visual style element.

GetTextExtent(IDeviceContext, Rectangle, String, TextFormatFlags)

Returns the size and location of the specified string when drawn with the font of the current visual style element within the specified initial bounding rectangle.

GetTextExtent(IDeviceContext, String, TextFormatFlags)

Source:
VisualStyleRenderer.cs
Source:
VisualStyleRenderer.cs
Source:
VisualStyleRenderer.cs

Returns the size and location of the specified string when drawn with the font of the current visual style element.

public:
 System::Drawing::Rectangle GetTextExtent(System::Drawing::IDeviceContext ^ dc, System::String ^ textToDraw, System::Windows::Forms::TextFormatFlags flags);
public System.Drawing.Rectangle GetTextExtent (System.Drawing.IDeviceContext dc, string textToDraw, System.Windows.Forms.TextFormatFlags flags);
member this.GetTextExtent : System.Drawing.IDeviceContext * string * System.Windows.Forms.TextFormatFlags -> System.Drawing.Rectangle
Public Function GetTextExtent (dc As IDeviceContext, textToDraw As String, flags As TextFormatFlags) As Rectangle

Parameters

dc
IDeviceContext

The IDeviceContext this operation will use.

textToDraw
String

The string to measure.

flags
TextFormatFlags

A bitwise combination of the TextFormatFlags values.

Returns

A Rectangle that contains the area required to fit the rendered text.

Exceptions

dc is null.

Applies to

GetTextExtent(IDeviceContext, Rectangle, String, TextFormatFlags)

Source:
VisualStyleRenderer.cs
Source:
VisualStyleRenderer.cs
Source:
VisualStyleRenderer.cs

Returns the size and location of the specified string when drawn with the font of the current visual style element within the specified initial bounding rectangle.

public:
 System::Drawing::Rectangle GetTextExtent(System::Drawing::IDeviceContext ^ dc, System::Drawing::Rectangle bounds, System::String ^ textToDraw, System::Windows::Forms::TextFormatFlags flags);
public System.Drawing.Rectangle GetTextExtent (System.Drawing.IDeviceContext dc, System.Drawing.Rectangle bounds, string textToDraw, System.Windows.Forms.TextFormatFlags flags);
member this.GetTextExtent : System.Drawing.IDeviceContext * System.Drawing.Rectangle * string * System.Windows.Forms.TextFormatFlags -> System.Drawing.Rectangle
Public Function GetTextExtent (dc As IDeviceContext, bounds As Rectangle, textToDraw As String, flags As TextFormatFlags) As Rectangle

Parameters

dc
IDeviceContext

The IDeviceContext this operation will use.

bounds
Rectangle

A Rectangle used to control the flow and wrapping of the text.

textToDraw
String

The string to measure.

flags
TextFormatFlags

A bitwise combination of the TextFormatFlags values.

Returns

A Rectangle that contains the area required to fit the rendered text.

Exceptions

dc is null.

Applies to