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 值的有效按位组合。
注解
如果需要多行并且指定格式允许,则返回的大小包括所有行的组合高度。