CListCtrl 添加CheckBox、整行选中、表格线属性代码 

baidu: "ccheckbox clistctrl" http://recall.blog.163.com/blog/static/103669852007017114326903/ //获取原风格属性 DWORD dwStyle = m_List.GetExtendedStyle(); //添加CheckBox、整行选中、表格线属性 dwStyle |= LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES; //设置新属性到控件 m_List1.SetExtendedStyle( dwStyle ); 初始化: m_liList1.InsertColumn(0, " "); m_liList1.SetColumnWidth(0,20); m_liList1.InsertColumn(1, "Name"); m_liList1.SetColumnWidth(1,100); m_liList1.InsertColumn(2, "Status"); m_liList1.SetColumnWidth(2,100); CString strTemp; for (int i=0; i<10; i++) { strTemp.Format("No:Name%03d", i+1); m_liList1.InsertItem(i, ""); m_liList1.SetItemText(i, 1, strTemp); } CheckBox检查函数: void CCheckBox_ListCtrlDlg::OnButton1() { // TODO: Add your control notification handler code here for (int i=0; i<10; i++) { if (m_List.GetCheck(i)) { m_List.SetTextColor(RGB(255,127,135)); m_List1.SetItemText(i,2, "Chechked"); } else { m_List.SetTextColor(RGB(125,127,255)); m_List.SetItemText(i,2, ""); } } }

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值