VC List Control控件如何删除选中的记录实例详解
2017-06-25 10:19
579 查看
VC List Control控件如何删除选中的记录实例详解
实例代码:
OnButtonDelete() { POSITION pos = m_list.GetFirstSelectedItemPosition(); int idx = m_list.GetNextSelectedItem(pos); while (idx != -1){ LVITEM lvi; lvi.iItem = idx; lvi.iSubItem = 0; lvi.mask = LVIF_IMAGE; if (m_list.GetItem(&lvi)){ m_imgList.Remove(lvi.iImage); //同时删除ImageList中的对应图片 } m_list.DeleteItem(idx); idx = m_list.GetNextSelectedItem(pos); }
需要先排序,再重绘,否则从中间删除后该区域会空白,后面的记录不会自动上移
m_list.Arrange(LVA_DEFAULT); m_list.RedrawItems(0, m_list.GetItemCount()); }
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
您可能感兴趣的文章:
相关文章推荐
- VC List Control控件删除选中的记录
- VC2005中list control控件如何获得选中的行
- 删除列表控件(List Control)中的所有选中行(多选)
- [VB.NET]如何在DataGridView控件中增加、删除和修改记录(用程序代码的方法)
- How to enumerate the system fonts in the combobox control using VC++ - 用VC++如何在ComboBox控件中枚举系统字体
- VC中如何使listctrl在点击控件空白处后还能保持上次的选中状态
- Vc控件用法总结之List Control
- 如何得到ListControl选中的项 ListControl选中一行
- 批量删除记录时如何实现全选方法总结 (转)http://www.cnblogs.com/chenou/articles/1349646.html[Asp.net Ajax 控件]
- vc++中利用ado和listcontrol控件进行数据库应用开发的一点总结
- VC++ 中如何更改Tree Control控件中节点的背景色和节点文字的颜色
- List Control 控件 详解1
- VC list control中设置某行选中
- VC(MFC)以ADO连接数据库(基于控件ListControl)
- 如何用JS删除checkbox选中的记录
- 关于TdxTreeList控件中如何判断点CHECK标题是否已经选中或取消自己的问题?
- How to add ComboBox control to the ToolBar control in VC - 如何在VC中向ToolBar控件加入ComboBox控件
- 如何得到ListControl选中的项 ListControl选中一行
- 如何设置TreeList控件中选中单元的背景色
- VC List Control控件高级使用