根据字体大小的增加更改框架窗口的大小 [英] change the frame window size according to font size increases

查看:102
本文介绍了根据字体大小的增加更改框架窗口的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!


我有一个SDI应用程序,默认情况下应采用80x24(宽度分别为80个字符和24个字符为高度).如果字体大小也增加,则只能采用相同的80x24字符.意味着窗口大小必须相应增加.

在这里,我使用等距字体.

请发送示例应用程序或任何相关链接.

Hello all!!


I have an SDI application, by default it should adopt 80x24 (width is 80 characters and 24 characters is height respectively need to occupy). If font size increases also it should adopt the same 80x24 characters only. means window size has to increase accordingly.

Here i''m using mono spaced font.

please send sample application or any related link.

thanks and regards sam.

推荐答案

您可以使用带有DT_CALCRECT标志的CDC :: DrawText来计算包含80个字符的字符串的大小(矩形).使用结果并计算工作区域"的大小,并在其周围添加一个小的填充缓冲区,并添加框架窗口的宽度和高度(包括标题栏,状态栏等).

并在创建大型机时使用结果.


最大.
You could use CDC::DrawText with the DT_CALCRECT flag to compute the size (rect) of a string containing 80 charaters; use the result and compute the size of your "work area" and add a small padding buffer around it and add the width and height of the frame window (including the title bar, status bar, ... )

And use the result when creating the mainframe.


Max.


当字体大小更改时,您只需要根据新的
When the font size changes you just need to recalculate the width and height of your window based on the new TextMetric[^] values.


这篇关于根据字体大小的增加更改框架窗口的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆