CRichEditCtrl 的用法
(2012-06-26 16:04:21)
标签:
杂谈 |
在一些交互性很强的程序中,经常需要使用CRichEditCtrl控件,但是如何进行编辑文本,如设置文本字体,颜色,链接,插入图片等等,如何进行操
作,这儿就转载一篇文章,收集一些常见的问题和解决方法,说不定哪一天就用到了。我以前开发过一个聊天程序,调用了一个人开发的CMyRichEdit扩
展,实现了字体,颜色,添加链接,插入图片(QQ控件)等等。
m_edit1代表ID为IDC_EDIT1的CEdit控件的control类型的变量
________________________________________
1.设置edit只读属性
________________________________________
2.判断edit中光标状态并得到选中内容(richedit同样适用)
________________________________________
3.在edit最后添加字符串
________________________________________
4.随输入自动滚动到最后一行(richedit同样适用)
________________________________________
5.如何限制edit输入指定字符
________________________________________
6.如何使用richedit
________________________________________
7.如何使用richedit2.0 or richedit3.0
________________________________________
8.改变richedit指定区域的颜色及字体
________________________________________
9.设置行间距(只适用于richedit2.0)
________________________________________
10.richedit插入位图
Q220844:How to insert a bitmap into an RTF document using the
RichEdit control in Visual C++ 6.0
http://support.microsoft.com/default.aspx?scid=kb;en-us;220844
http://www.codeguru.com/Cpp/controls/richedit/article.php/c2417/
http://www.codeguru.com/Cpp/controls/richedit/article.php/c5383/
________________________________________
11.richedit插入gif动画
http://www.codeproject.com/richedit/AnimatedEmoticon.asp
________________________________________
12.richedit嵌入ole对象
http://support.microsoft.com/kb/141549/en-us
________________________________________
13.使richedit选中内容只读
http://www.codeguru.com/cpp/controls/richedit/article.php/c2401/
________________________________________
14.打印richedit
http://www.protext.com/MFC/RichEdit3.htm
________________________________________
15.richeidt用于聊天消息窗口
http://www.vckbase.com/document/viewdoc/?id=1087
http://www.codeproject.com/richedit/chatrichedit.asp
http://www.codeguru.com/Cpp/controls/richedit/article.php/c2395/
________________________________________
16.解决richedit的EN_SETFOCUS和EN_KILLFOCUS无响应的问题
http://support.microsoft.com/kb/181664/en-us
________________________________________
17.richedit拼写检查
http://www.codeproject.com/com/AutoSpellCheck.asp
________________________________________
18.改变edit背景色
Q117778:How to change the background color of an MFC edit
control
http://support.microsoft.com/kb/117778/en-us
________________________________________
19.当edit控件的父窗口属性是带标题栏WS_CAPTION和子窗口WS_CHILD时,不能设置焦点SetFocus
Q230587:PRB: Can't Set Focus to an Edit Control When its
Parent Is an Inactive Captioned Child Window
http://support.microsoft.com/kb/230587/en-us
________________________________________
20. 在Edit中回车时,会退出对话框
选中Edit的风格Want Return。
MSDN的解释如下:
ES_WANTRETURN Specifies that a carriage
return be inserted when the user presses the ENTER key while
entering text into a multiple-line edit control in a dialog box.
Without this style, pressing the ENTER key has the same effect as
pressing the dialog box's default pushbutton. This style. has no
effect on a single-line edit control.
________________________________________
21. 动态创建的edit没有边框的问题

加载中…