Share via


VisualStyleRenderer.GetTextExtent 方法

定義

當使用目前視覺化樣式項目的字型繪製時,傳回指定的字串大小和位置。

多載

GetTextExtent(IDeviceContext, String, TextFormatFlags)

當使用目前視覺化樣式項目的字型繪製時,傳回指定的字串大小和位置。

GetTextExtent(IDeviceContext, Rectangle, String, TextFormatFlags)

當使用目前視覺化樣式項目的字型在指定的初始週框內繪製時,傳回指定的字串大小和位置。

GetTextExtent(IDeviceContext, String, TextFormatFlags)

當使用目前視覺化樣式項目的字型繪製時,傳回指定的字串大小和位置。

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

參數

dc
IDeviceContext

此作業將使用的 IDeviceContext

textToDraw
String

要測量的字串。

flags
TextFormatFlags

TextFormatFlags 值的位元組合。

傳回

Rectangle

Rectangle,包含容納呈現之文字所需的區域。

例外狀況

dcnull

適用於

GetTextExtent(IDeviceContext, Rectangle, String, TextFormatFlags)

當使用目前視覺化樣式項目的字型在指定的初始週框內繪製時,傳回指定的字串大小和位置。

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

參數

dc
IDeviceContext

此作業將使用的 IDeviceContext

bounds
Rectangle

Rectangle,用於控制文字的流向和換行。

textToDraw
String

要測量的字串。

flags
TextFormatFlags

TextFormatFlags 值的位元組合。

傳回

Rectangle

Rectangle,包含容納呈現之文字所需的區域。

例外狀況

dcnull

適用於