在MFC中如何在编辑框中垂直对齐文本? [英] In MFC how to vertically align text in edit box?

查看:607
本文介绍了在MFC中如何在编辑框中垂直对齐文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的基于MFC对话框的应用程序中,我想在编辑控件中垂直对齐文本。我的编辑控件没有使用WS_BORDER样式。



我尝试过:



通过此链接 c ++ - 我们如何垂直对齐文本在编辑框? - 堆栈溢出 [ ^ ]我能够解决问题。

该链接正在处理ON_WM_NCCALCSIZE()和ON_WM_NCPAINT()消息。我想知道我是否可以满足我的要求通过仅重写onPaint()而不覆盖ON_WM_NCCALCSIZE()和ON_WM_NCPAINT()消息?

Hi,
In my MFC dialog based application I want to align the text vertically in edit control. My Edit control is not using WS_BORDER style.

What I have tried:

Through this link c++ - How can we vertically align text in edit box? - Stack Overflow[^] I am able to solve the problem.
That link is handling ON_WM_NCCALCSIZE() and ON_WM_NCPAINT() messages.I would like to know can I meet my requirement by overriding only onPaint() without overriding ON_WM_NCCALCSIZE() and ON_WM_NCPAINT() messages?

推荐答案

使用多行文本框并根据需要添加自己的换行符。



保存时删除换行符(使用标记)。



输入应始终清理 /在任何情况下修剪。
Use a multi-line text box and add you own line breaks as needed.

Remove the line breaks when saving (use markers).

Input should always be "cleaned" / trimmed in any event.


这篇关于在MFC中如何在编辑框中垂直对齐文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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