VisualStyleRenderer.GetTextExtent Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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)
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
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)
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
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
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기