System::Drawing::Graphics::MeasureString 方法

Graphics::MeasureString(String const&, System::SharedPtr<Font> const&, int, System::SharedPtr<StringFormat> const&) const method

返回在指定字体和指定格式下绘制的指定字符串的大小。

SizeF System::Drawing::Graphics::MeasureString(String const &str, System::SharedPtr<Font> const &font, int width, System::SharedPtr<StringFormat> const &stringFormat=nullptr) const
参数类型描述
strString const&要计算其尺寸的字符串
字体System::SharedPtr<Font> const&用于绘制字符串的字体
widthint字符串的最大宽度
stringFormatSystem::SharedPtr<StringFormat> const&指定字符串格式

ReturnValue

一个 SizeF 对象,表示当前 Grapphics 对象的 PageUnit 属性指定的测量单位下字符串的尺寸。

另见

Graphics::MeasureString(String const&, System::SharedPtr<Font> const&, PointF const&, System::SharedPtr<StringFormat> const&) const method

返回在指定字体和指定格式下绘制的指定字符串的大小。

SizeF System::Drawing::Graphics::MeasureString(String const &str, System::SharedPtr<Font> const &font, PointF const &origin=PointF(0, 0), System::SharedPtr<StringFormat> const &stringFormat=nullptr) const
参数类型描述
strString const&要计算其尺寸的字符串
字体System::SharedPtr<Font> const&用于绘制字符串的字体
originPointF const&指定字符串左上角的位置
stringFormatSystem::SharedPtr<StringFormat> const&指定字符串格式

ReturnValue

一个 SizeF 对象,表示当前 Grapphics 对象的 PageUnit 属性指定的测量单位下字符串的尺寸。

另见

Graphics::MeasureString(String const&, System::SharedPtr<Font> const&, SizeF const&, System::SharedPtr<StringFormat> const&, int&, int&) const method

未实现。

SizeF System::Drawing::Graphics::MeasureString(String const &str, System::SharedPtr<Font> const &font, SizeF const &layoutArea, System::SharedPtr<StringFormat> const &stringFormat, int &charactersFitted, int &linesFilled) const

另见

Graphics::MeasureString(String const&, System::SharedPtr<Font> const&, SizeF const&, System::SharedPtr<StringFormat> const&) const method

返回在指定字体和指定格式下绘制的指定字符串的大小。

SizeF System::Drawing::Graphics::MeasureString(String const &str, System::SharedPtr<Font> const &font, SizeF const &layoutArea, System::SharedPtr<StringFormat> const &stringFormat=nullptr) const
参数类型描述
strString const&要计算其尺寸的字符串
字体System::SharedPtr<Font> const&用于绘制字符串的字体
layoutAreaSizeF const&字符串的最大布局区域
stringFormatSystem::SharedPtr<StringFormat> const&指定字符串格式

ReturnValue

一个 SizeF 对象,表示当前 Grapphics 对象的 PageUnit 属性指定的测量单位下字符串的尺寸。

另见