MFC编辑每行的控制设置长度 [英] MFC Edit Control setting length for each line

查看:110
本文介绍了MFC编辑每行的控制设置长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在编辑控件中设置每一行的长度?我正在从.txt文件中读取文本并在Edit Control中显示文本。我已将编辑控件的属性设置为多行但使用SetWindowTextW()显示的文本没有像文本文件那样以正确的格式显示。我认为每行的长度都有问题。

How to set length for each line in edit control?I am reading text from .txt file and displaying text in Edit Control.I''ve set the property of edit control as multiline but text which is displayed using SetWindowTextW() is not showing in proper format as in text file.I think there is problem with Length of each line.

推荐答案

如果将编辑控件设置为多行,然后设置线路大小限制的方式是:

(1)添加人工\\\\ n换行符(使线路更短)

(2)更改字体(大小或字体)。比例字体将在每行显示不同数量的字符,具体取决于行内容。非比例字体将在每一行显示相同数量的字符。

(3)调整控件的大小。



如果一行你读入并尝试在控件上显示的时间长于控件在一行上显示的时间,它将断开该行并显示下一行行的最后一部分。
If you set the edit control as multi-line, then the way(s) to set the line size limit are:
(1) adding artificial "\r\n" line breaks (to make the line shorter)
(2) changing the font (size or typeface). A proportional font will display a different number of characters on each line, depending on line content. A non-proportional font will display the same number of characters on each line.
(3) resizing the control.

If a line you read in and try to display on the control is longer than the control will hold on one line, it will break the line and display the last part on the ''next'' line.


这篇关于MFC编辑每行的控制设置长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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