计算gdi 函数DrawString绘制的字符串象素长度和高度

 

graphics.MeasureString(wName, wName.GetLength(), &font1, PointF(nLINE_LEFT+45, nTop+10), &rtGdiplus);

 

带StringFormat(不带的话测出的值比实际的大):

RectF rectf;

StringFormat sf;

g.MeasureString(nick.c_str(), nick,size(), &font, ptF2,sf.GenericTypographic(), &rectf);

posted @ 2020-10-13 11:58  _KikyoBK  Views(288)  Comments(0Edit  收藏  举报