做有关兼职网站的需求分析,个人做网站要缴税,百度应用宝,唐山网站建设电话1、本程序基于前期我的博客文章《MFC下拉菜单打钩图标存取实例#xff08;源码下载#xff09;》 2、程序功能选中列表控件某一项#xff0c;修改这一项的按钮由禁止变为可用#xff0c;双击这个按钮弹出对话框可对这一项的记录数据进行修改#xff0c;点击确定保存修改数…1、本程序基于前期我的博客文章《MFC下拉菜单打钩图标存取实例源码下载》 2、程序功能选中列表控件某一项修改这一项的按钮由禁止变为可用双击这个按钮弹出对话框可对这一项的记录数据进行修改点击确定保存修改数据。 3、首先在主界面添加一个修改参数按钮。 4、在myDlg.h 文件 class CMyDlg : public CDialog中添加代码
public:
void UpdateButton(void);
protected:
virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);5、选中列表控件右击选择“事件…”在弹出的事件句柄中选择“LVN_ITEMCHANGED”如下图所示。
void CMyDlg::OnItemchangedList1(NMHDR* pNMHDR, LRESULT* pResult)
{NM_LISTVIEW* pNMListView (NM_LISTVIEW*)pNMHDR;POSITION pos m_ctrlType.GetFirstSelectedItemPosition();if(pos ! NULL){int nItem m_ctrlType.GetNextSelectedItem(pos);if(m_nTypeIndex ! nItem){m_nTypeIndex nItem;}}elsem_nTypeIndex -1; *pResult 0;
}
6、在myDlg.cpp 文件中添加代码
LRESULT CMyDlg::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{// TODO: Add your specialized code here and/or call the base classstatic int nTypeIndex -2;if(::IsWindow(m_ctrlType.m_hWnd)){if(m_nTypeIndex ! nTypeIndex){nTypeIndex m_nTypeIndex;UpdateButton();}}return CDialog::DefWindowProc(message, wParam, lParam);
}void CMyDlg::UpdateButton()
{GetDlgItem(IDC_BUTTON3)-EnableWindow(m_nTypeIndex -1);
}
7、在myDlg.cpp 文件中参数按钮中添加代码
void CMyDlg::OnButton3()
{CTypeParaDlg dlg;dlg.m_pPara theApp.m_allPara[m_nTypeIndex];if(dlg.DoModal() IDOK){LV_ITEM item;item.mask LVIF_TEXT|LVIF_IMAGE;item.iItem m_nTypeIndex;item.iSubItem 0;item.pszText theApp.m_allPara[m_nTypeIndex].m_strTypeName;item.iImage 0;m_ctrlType.SetItem(item);item.iSubItem 1;item.pszText theApp.m_allPara[m_nTypeIndex].m_strBrand;m_ctrlType.SetItem(item);item.iSubItem 2;item.pszText theApp.m_allPara[m_nTypeIndex].m_strRemark;m_ctrlType.SetItem(item);}
}运行程序 源码下载