像聊天室的屏幕一样,最新的内容在最下面,不过编辑框滚动到最下面的方法。
CEditm_CtrlEdit;
CString m_szMsgSay = "新加入的聊天内容";
CString tmp;
void CMsgDlg::OnButtonSay()
{
UpdateData(TRUE);
tmp += m_szMsgSay;
m_CtrlEdit.SetWindowText(tmp);
m_CtrlEdit.SetScrollPos(SB_VERT,m_CtrlEdit.GetLineCount(),TRUE);
UpdateData(FALSE);
}
SetScrollPos是CWnd的.
CEdit Class Members
Construction
Attributes
Operations
Clipboard Operations
Construction
CEdit |
Constructs a CEdit control object. |
Create |
Creates the Windows edit control and attaches it to the CEdit object. |
CEdit Attributes
CanUndo |
Determines whether an edit-control operation can be undone. |
GetLineCount |
Retrieves the number of lines in a multiple-line edit control. |
GetModify |
Determines whether the contents of an edit control have been modified. |
SetModify |
Sets or clears the modification flag for an edit control. |
GetRect |
Gets the formatting rectangle of an edit control. |
GetSel |
Gets the starting and ending character positions of the current selection in an edit control. |
GetHandle |
Retrieves a handle to the memory currently allocated for a multiple-line edit control. |
SetHandle |
Sets the handle to the local memory that will be used by a multiple-line edit control. |
SetMargins |
Sets the left and right margins for this CEdit. |
GetMargins |
Gets the left and right margins for this CEdit. |
SetLimitText |
Sets the maximum amount of text this CEdit can contain. |
GetLimitText |
Gets the maximum amount of text this CEdit can contain. |
PosFromChar |
Retrieves the coordinates of the upper-left corner of a specified character index. |
CharFromPos |
Retrieves the line and character indices for the character closest to a specified position. |
GetLine |
Retrieves a line of text from an edit control. |
GetPasswordChar |
Retrieves the password character displayed in an edit control when the user enters text. |
GetFirstVisibleLine |
Determines the topmost visible line in an edit control. |
CEdit Operations
EmptyUndoBuffer |
Resets (clears) the undo flag of an edit control. |
FmtLines |
Sets the inclusion of soft line-break characters on or off within a multiple-line edit control. |
LimitText |
Limits the length of the text that the user may enter into an edit control. |
LineFromChar |
Retrieves the line number of the line that contains the specified character index. |
LineIndex |
Retrieves the character index of a line within a multiple-line edit control. |
LineLength |
Retrieves the length of a line in an edit control. |
LineScroll |
Scrolls the text of a multiple-line edit control. |
ReplaceSel |
Replaces the current selection in an edit control with the specified text. |
SetPasswordChar |
Sets or removes a password character displayed in an edit control when the user enters text. |
SetRect |
Sets the formatting rectangle of a multiple-line edit control and updates the control. |
SetRectNP |
Sets the formatting rectangle of a multiple-line edit control without redrawing the control window. |
SetSel |
Selects a range of characters in an edit control. |
SetTabStops |
Sets the tab stops in a multiple-line edit control. |
SetReadOnly |
Sets the read-only state of an edit control. |
CEdit Clipboard Operations
Undo |
Reverses the last edit-control operation. |
Clear |
Deletes (clears) the current selection (if any) in the edit control. |
Copy |
Copies the current selection (if any) in the edit control to the Clipboard in CF_TEXT format. |
Cut |
Deletes (cuts) the current selection (if any) in the edit control and copies the deleted text to the Clipboard in CF_TEXT format. |
Paste |
Inserts the data from the Clipboard into the edit control at the current cursor position. Data is inserted only if the Clipboard contains data in CF_TEXT format. |
CEdit Overview | Base Class Members | Hierarchy Chart
分享到:
相关推荐
CEdit编辑框背景闪动
028MFC控件之编辑框CEdit,MFC的编辑框及平时用的输入框,可以往里面输入文本或数字,编辑框对应的MFC类为CEdit,CEdit提供了窗口编辑框的功能
薄利多销 FlexGrid控件 内嵌编辑框CEdit 集成了改变CEdit字体和背景颜色的类, 并且也集成了不内嵌编辑框也能使FlexGrid进行文字输入的Grid类。使用方便,但不是很完善
自定义编辑框是登陆界面经常用到的效果,所以我也模仿站酷网的素材做了个。 要想继承CCustomDraw来完全自绘CEdit控件,是不太可行的方案,因为一旦你完全重绘,那么你需要额外做以下几件事: 1. CEdit光标的处理; 2...
此类实现了动态改变 CEdit编辑框 背景颜色和文字颜色的功能,再辅助与获取焦点响应函数可以使编写的软件更加美观。
能够修改编辑框的大小和字体,cedit类,对于初学者很有帮助
多个编辑框,单击每个编辑框都要弹出数字键盘,在编辑的位置弹出,并且数据直接编辑到当前的编辑框,按自定义键盘上的数字键,所对应的数据直接显示到要编辑的对话框中,工具用的VS2017
CEdit框字体垂直居中
//切换编辑框焦点 if (m_nFocus == 0) { if (pEdit2->SetFocus()) { m_nFocus = 1; } } else if (m_nFocus == 1) { if (pEdit1->SetFocus()) { m_nFocus = 0; } }
本博客近期每天推出MFC实例课程讲解,如果你对此感兴趣, 欢迎访问我的博客主页,http://www.gymsaga.com/ ... ... 如果你有什么不懂的,或者我讲的地方有那些不对或者不恰当的地方,也欢迎你批评指正
扩展MFC编辑框控件的功能,修改编辑框背景颜色,文字格式,以及边框颜色等
本博客近期每天推出MFC实例课程讲解,如果你对此感兴趣, 欢迎访问我的博客主页,http://www.gymsaga.com/ ... ... 如果你有什么不懂的,或者我讲的地方有那些不对或者不恰当的地方,也欢迎你批评指正
MFC中cedit控件的使用方法,具体详细地介绍了其中的各种方法,如何使用
CListCtrl 编辑表格实现,CEdit 的回车响应事件,大部分是摘抄的网上的资源,自己在使用时进行了整理,整个是实现了CListCtrl 的可编辑!
这是个编辑框开源的控件,有使用编辑框的同仁赶紧下。欢迎大家评论。怎么发布两遍都不成功
CEdit改变字体颜色及背景色!(CEditEx.h/CEditEx.cpp)
带有CEdit CComBox的CListCtrl派生类
可以显示行号的编辑框,继承CEDIT,可以方便设置背景色
[最新] MFC CEdit控件添加边框的颜色