共用方式為


CTreeCtrl::EditLabel

Call this function to begin in-place editing of the specified item's text.

CEdit* EditLabel( 
   HTREEITEM hItem  
);

Parameters

  • hItem
    Handle of the tree item to be edited.

Return Value

If successful, a pointer to the CEdit object that is used to edit the item text; otherwise NULL.

Remarks

The editing is accomplished by replacing the text of the item with a single-line edit control containing the text.

Example

// Make sure the focus is set to the tree control.
m_TreeCtrl.SetFocus();

// Show the edit control on the label of the selected item. 
// The tree control must have the TVS_EDITLABELS style set.
HTREEITEM hSel = m_TreeCtrl.GetSelectedItem();
CEdit* pmyEdit = m_TreeCtrl.EditLabel(hSel);
ASSERT(pmyEdit != NULL);

Requirements

Header: afxcmn.h

See Also

Reference

CTreeCtrl Class

Hierarchy Chart

CTreeCtrl::GetEditControl