CListCtrl
CEdit* GetEditControl( ) const;Return ValueIf successful, a pointer to the CEdit object that is used to edit the item text; otherwise NULL.ResRetrieves the handle of the edit control used to edit a list view item’s text.Example// The pointer to my list view control.
extern CListCtrl* pmyListCtrl;
// The string replacing the text in the edit control.
extern LPCTSTR lpszmyString;// If possible, replace the text in the label edit control.
CEdit* pEdit = pmyListCtrl->GetEditControl();if (pEdit != NULL)
{
pEdit->SetWindowText(lpszmyString);
}CList::EditLabel(int);
CEdit* EditLabel( int nItem );Return ValueIf successful, a pointer to the CEdit object that is used to edit the item text; otherwise NULL.ParametersnItemIndex of the list view item that is to be edited.ResA list view control that has the LVS_EDITLABELS window style enables a user to edit item labels in place. The user begins editing by clicking the label of an item that has the focus.Use this function to begin in-place editing of the specified list view item’s text.Example// The pointer to my list view control.
extern CListCtrl* pmyListCtrl;// Make sure the focus is set to the list view control.
pmyListCtrl->SetFocus();// Show the edit control on the label of the first
// item in the list view control.
CEdit* pmyEdit = pmyListCtrl->EditLabel(1);
ASSERT(pmyEdit != NULL);别的没什么好说, 注意用此类函数前, 最好将控件SetFocus(); sad_pacific
CEdit* GetEditControl( ) const;Return ValueIf successful, a pointer to the CEdit object that is used to edit the item text; otherwise NULL.ResRetrieves the handle of the edit control used to edit a list view item’s text.Example// The pointer to my list view control.
extern CListCtrl* pmyListCtrl;
// The string replacing the text in the edit control.
extern LPCTSTR lpszmyString;// If possible, replace the text in the label edit control.
CEdit* pEdit = pmyListCtrl->GetEditControl();if (pEdit != NULL)
{
pEdit->SetWindowText(lpszmyString);
}CList::EditLabel(int);
CEdit* EditLabel( int nItem );Return ValueIf successful, a pointer to the CEdit object that is used to edit the item text; otherwise NULL.ParametersnItemIndex of the list view item that is to be edited.ResA list view control that has the LVS_EDITLABELS window style enables a user to edit item labels in place. The user begins editing by clicking the label of an item that has the focus.Use this function to begin in-place editing of the specified list view item’s text.Example// The pointer to my list view control.
extern CListCtrl* pmyListCtrl;// Make sure the focus is set to the list view control.
pmyListCtrl->SetFocus();// Show the edit control on the label of the first
// item in the list view control.
CEdit* pmyEdit = pmyListCtrl->EditLabel(1);
ASSERT(pmyEdit != NULL);别的没什么好说, 注意用此类函数前, 最好将控件SetFocus(); sad_pacific
多谢指点。 pmyListCtrl->EditLable(nItem) 只能编辑第一列,我想编辑第2,3
等列, 怎么办呢 ?
我这里有一个例子可实现你所要的功能, 给我一个Mail我给你发去..
[email protected] sad pacific