在MFC应用程序中显示文本 [英] Display text in a MFC application

查看:209
本文介绍了在MFC应用程序中显示文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在MFC应用程序中显示文本.我有一个示例文本,例如在mfc应用程序中显示文本".假设我打算在其中绘制此文本的客户窗口很小(水平),以至于一行中唯一可以容纳的文本是显示文本".不显示"mfc应用程序"字样.我的问题是,如何确保这些单词显示在下一行而不是被剪切掉?我正在使用drawtext函数显示文本.

I need to display text in an MFC application. I have a sample text like "Display text in mfc application". Let's assume the client window in which I intend to draw this text is so small(horizontally) that in one line the only text that can fit is "Display text in". The words "mfc application" are not displayed. My question is, how do I ensure that these words are displayed in the next line, instead of just being clipped off?I'm using the drawtext function to display the text.

谢谢.

推荐答案

我也遇到了您报告的问题.并按照我在 https://stackoverflow.com/a/29241196/383779

I had also the problem you reported. And solved it as I explained in https://stackoverflow.com/a/29241196/383779

您首先需要使用DT_CALCRECT标志调用DrawText,以了解将哪个矩形传递给DrawText真正使工作正常进行.

You need first a call to DrawText with the DT_CALCRECT flag to know what rectangle to pass to the DrawText that really makes the work.

这很奇怪,但是……确实如此. MFC ...你知道的.

It is strange but ... it is the way it is. MFC ... you know.

这篇关于在MFC应用程序中显示文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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