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