// MyListCtrl.cpp : 实现文件 // #include "stdafx.h" #include "EditListCtrl.h" #include "MyListCtrl.h" // CMyListCtrl IMPLEMENT_DYNAMIC(CMyListCtrl, CListCtrl) CMyListCtrl::CMyListCtrl() { } CMyListCtrl::~CMyListCtrl() { } BEGIN_MESSAGE_MAP(CMyListCtrl, CListCtrl) ON_WM_LBUTTONDOWN() ON_NOTIFY_REFLECT(LVN_ENDLABELEDIT, &CMyListCtrl::OnLvnEndlabeledit) END_MESSAGE_MAP() // CMyListCtrl 消息处理程序 void CMyListCtrl::PreSubclassWindow() { // TODO: 在此添加专用代码和/或调用基类 CListCtrl::PreSubclassWindow(); ModifyStyle(0, LVS_EDITLABELS); } void CMyListCtrl::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: 在此添加消息处理程序代码和/或调用默认值 LVHITTESTINFO lvhit; lvhit.pt = point; int item = SubItemHitTest(&lvhit); //if (over a item/subitem) if (item != -1 && (lvhit.flags & LVHT_ONITEM)) { //CListCtrl::OnLButtonDown(nFlags, point); EditLabel(lvhit.iItem); } } void CMyListCtrl::OnLvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult) { NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR); // TODO: 在此添加控件通知处理程序代码 LV_ITEM *plvItem = &pDispInfo->item; if (plvItem->pszText != NULL ) { SetItemText(plvItem->iItem, plvItem->iItem, plvItem->pszText); } //VERIFY(m_edtItemEdit.UnsubclassWindow()!=NULL); *pResult = 0; } // MyListCtrl.cpp : 实现文件 // #include "stdaf 你的当前访问异常,请进行认证后继续阅读剩余内容。 提交