CEditView::GetEditCtrl

调用 GetEditCtrl 获取对edit视图使用的编辑控件。

CEdit& GetEditCtrl( ) const;

返回值

CEdit 对象的引用。

备注

该控件是类型 CEdit,直接使用 CEdit 成员函数,因此,您可以操作Windows编辑控件。

警告说明警告

使用 CEdit 对象可以更改基础Windows的状态编辑控件。例如,您不应更改制表符设置使用 CEdit::SetTabStops 功能,因为 CEditView 缓存这些设置在编辑控件和打印。相反,应使用 CEditView::SetTabStops

示例

void CMyEditView::OnInitialUpdate()
{
   CEditView::OnInitialUpdate();

   // get the edit control and set some initial properties for it
   CEdit& theEdit = GetEditCtrl();

   // adjust the left margin without changing the right margin
   DWORD dwMargins = theEdit.GetMargins();
   theEdit.SetMargins(20, HIWORD(dwMargins));

   // only accept 10k of text
   theEdit.SetLimitText(10 * 1024);
}

要求

Header: afxext.h

请参见

参考

CEditView选件类

层次结构图

CEdit选件类

CEditView::SetTabStops