个人技术分享

1、本程序基于前期我的博客文章《MFC下拉菜单打钩图标存取实例(源码下载) 》
2、程序功能选中列表控件某一项,删除按钮由禁止变为可用,点击删除按钮,选中的项将删除。
3、首先在主界面添加一个删除参数按钮。
在这里插入图片描述
4、在myDlg.cpp 文件UpdateButton()中代码修改如下

void CMyDlg::UpdateButton()
{
	GetDlgItem(IDC_BUTTON3)->EnableWindow(m_nTypeIndex > -1);
	GetDlgItem(IDC_BUTTON4)->EnableWindow(m_nTypeIndex > -1);
}

5、在myDlg.cpp 文件中删除按钮中添加代码

void CMyDlg::OnButton4() 
{
if(m_nTypeIndex < theApp.m_nProductSel)
		theApp.m_nProductSel--;
	theApp.m_allPara.RemoveAt(m_nTypeIndex);
	m_ctrlType.DeleteItem(m_nTypeIndex);	
}

运行程序
在这里插入图片描述
源码下载