1 CRect rectDraw; CDC dc;
2 CRect temp = rectDraw;
3 int height = dc.DrawText(_T("测试文本"), temp, DT_CENTER | DT_WORDBREAK | DT_EDITCONTROL | DT_CALCRECT);//获得文本高度
4 rectDraw.DeflateRect(0, (rectDraw.Height() - height)/2);//改变rect
5 dc.DrawText(_T("测试文本"), rectDraw, DT_CENTER | DT_WORDBREAK | DT_EDITCONTROL);//显示文本

相关文章:

  • 2022-12-23
  • 2021-06-17
  • 2022-02-21
  • 2022-01-03
  • 2022-12-23
  • 2022-12-23
  • 2022-02-14
猜你喜欢
  • 2022-12-23
  • 2021-07-27
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2021-06-01
相关资源
相似解决方案