为什么字符串的宽度出来的一直是乱值?

fdshenjia 2008-11-20 02:47:58
代码如下:

FontFamily fontFamily(L"Times New Roman");
Font font(&fontFamily, 18, FontStyleRegular, UnitPixel);
SolidBrush solidBrush(Color(255, 255, 0, 0));
PointF pointF(0.0f, 0.0f);
RectF boundingBox;
graphics.MeasureString(L"abcdefghij", 10, &font, pointF, &boundingBox);

boundingBox.Width = 0, boundingBox.Height = 1079729936; 明显是个乱值,不知道为什么,如何得到正确的数值。
谢谢大侠的指导!
...全文
70 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

19,464

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧