如何在mfc的编辑框中垂直对齐文本? [英] How to align the text vertical in the edit box in mfc?
问题描述
在我的基于MFC对话框的应用程序中,我想在编辑控件中垂直对齐文本。我的Edit控件没有使用WS_BORDER样式。
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.
链接 https ://stackoverflow.com/questions/867207/how-can-we-vertically-align-text-in-edit-box
为我的问题提供解决方案,它对我有用。
The link https://stackoverflow.com/questions/867207/how-can-we-vertically-align-text-in-edit-box gives solution for my problem and it is working for me.
该链接正在处理ON_WM_NCCALCSIZE()和ON_WM_NCPAINT()消息。我想知道是否可以通过仅覆盖onPaint()而不覆盖ON_WM_NCCALCSIZE()来满足我的要求和ON_WM_NCPAINT()消息?
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?
推荐答案
覆盖OnPaint()比你想象的要繁琐得多。您必须处理字体,突出显示的文本(完全选择和部分选择),插入符号绘画,如果是密码类型,则确保您只显示星星等。
Overriding OnPaint() is much more tedious that you think. You woudl have to take care of fonts, highlighted text (both fully selected and partally selected), caret painting, if its a password type, then ensure you show only stars, etc.
处理WM_NCCALSIZE和WM_NCPAINT是最好的方法。
Handling WM_NCCALSIZE and WM_NCPAINT is the best way to go.
-Seetharam
-Seetharam
这篇关于如何在mfc的编辑框中垂直对齐文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!