共用方式為


CEditView::GetEditCtrl

Call GetEditCtrl to get a reference to the edit control used by the edit view.

CEdit& GetEditCtrl( ) const;

Return Value

A reference to a CEdit object.

Remarks

This control is of type CEdit, so you can manipulate the Windows edit control directly using the CEdit member functions.

Warning

Using the CEdit object can change the state of the underlying Windows edit control. For example, you should not change the tab settings using the CEdit::SetTabStops function because CEditView caches these settings for use both in the edit control and in printing. Instead, use CEditView::SetTabStops.

Example

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);
}

Requirements

Header: afxext.h

See Also

Reference

CEditView Class

Hierarchy Chart

CEdit Class

CEditView::SetTabStops