游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2716|回复: 3

如何计算字符串的输出宽度和高度?

[复制链接]

1

主题

2

帖子

6

积分

新手上路

Rank: 1

积分
6
发表于 2007-12-13 16:17:00 | 显示全部楼层 |阅读模式
我要边续输出两行文字,如何做才能令它们不会重叠
[em24]

2

主题

429

帖子

435

积分

中级会员

Rank: 3Rank: 3

积分
435
发表于 2007-12-13 19:31:00 | 显示全部楼层

Re:如何计算字符串的输出宽度和高度?

关键字: DrawText DT_CALCRECT

1

主题

2

帖子

6

积分

新手上路

Rank: 1

积分
6
 楼主| 发表于 2007-12-13 19:43:00 | 显示全部楼层

Re:如何计算字符串的输出宽度和高度?

我是说在opengl下的输出

2

主题

429

帖子

435

积分

中级会员

Rank: 3Rank: 3

积分
435
发表于 2007-12-14 21:13:00 | 显示全部楼层

Re:如何计算字符串的输出宽度和高度?

看这个你就明白了吧?

BOOL wglUseFontBitmaps(
  HDC  hdc,         // device context whose font will be used
  DWORD  first,     // glyph that is the first of a run of glyphs to
                    // be turned into bitmap display lists
  DWORD  count,     // number of glyphs to turn into bitmap display
                    // lists
  DWORD  listBase   // specifies starting display list
);

int DrawText(
  HDC hDC,          // handle to device context
  LPCTSTR lpString, // pointer to string to draw
  int nCount,       // string length, in characters
  LPRECT lpRect,    // pointer to struct with formatting dimensions
  UINT uFormat      // text-drawing flags
);
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-6-17 17:58

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表