DataGridViewCell.MeasureTextSize 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在指定的特性下,取得所指定文字的高度和寬度。
public:
static System::Drawing::Size MeasureTextSize(System::Drawing::Graphics ^ graphics, System::String ^ text, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags);
public static System.Drawing.Size MeasureTextSize (System.Drawing.Graphics graphics, string text, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags);
static member MeasureTextSize : System.Drawing.Graphics * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags -> System.Drawing.Size
Public Shared Function MeasureTextSize (graphics As Graphics, text As String, font As Font, flags As TextFormatFlags) As Size
參數
- text
- String
要測量的文字。
- flags
- TextFormatFlags
要套用至文字之 TextFormatFlags 值的位元組合。
傳回
Size,表示文字的高度和寬度。
例外狀況
flags
不是 TextFormatFlags 值的有效位元組合。
備註
如果需要多行且指定的格式允許,則傳回的大小會包含所有線條的組合高度。