AfxMessageBox(str);
=======================
设置样式
DWORD SetExtendedStyle(
DWORD dwNewStyle );
函数功能设置CListCtrl的扩展样式
dwNewStyle指定的扩展样式
LVS_EX_GRIDLINES //绘制表格
LVS_EX_SUBITEMIMAGES
LVS_EX_CHECKBOXES //带复选框
LVS_EX_TRACKSELECT //自动换行
LVS_EX_HEADERDRAGDROP
LVS_EX_FULLROWSELECT //选择整行
LVS_EX_ONECLICKACTIVATE//单击激活
LVS_EX_TWOCLICKACTIVATE//双击激活
LVS_EX_FLATSB//扁平滚动条
LVS_EX_REGIONAL
LVS_EX_INFOTIP
LVS_EX_UNDERLINEHOT
LVS_EX_UNDERLINECOLD
LVS_EX_MULTIWORKAREAS//多工作区
例子:
BOOL COnlineDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_OnlineList.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT);
m_OnlineList.InsertColumn(0,"IP地址",NULL,130,-1);
m_OnlineList.InsertColumn(1,"语言/区域",LVCFMT_CENTER,80,-1);
m_OnlineList.InsertColumn(2,"计算机名称",NULL,120,-1);
m_OnlineList.InsertColumn(3,"系统类型",NULL,100,-1);
m_OnlineList.InsertColumn(4,"内存(MB)",NULL,80,1);
m_OnlineList.InsertColumn(5,"CPU大小(MHz)",NULL,80,1);
m_OnlineList.InsertColumn(6,"软件版本",NULL,80,1);
m_OnlineList.InsertColumn(7,"状态",NULL,300,-1);
m_ImageOnlinelist.Create(16,16,ILC_COLOR32|ILC_MASK,2,2);
HICON hIcon0 = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ICON_PC));
m_ImageOnlinelist.Add(hIcon0);
m_OnlineList.SetImageList(&m_ImageOnlinelist,LVSIL_SMALL);//在线列表框添加图标
////===============删除==============
////删除整行选中的===============
// int count = m_lst->GetSelectedCount();
// if(count > 0){
// POSITION pos = m_lst->GetFirstSelectedItemPosition();
//while (pos != NULL)
//{
// int delId = m_lst->GetNextSelectedItem(pos);
// m_lst->DeleteItem(delId);
//}
// }
/////删除CHECKBOX选中的项============
for(int i = 0; i<m_lst->GetItemCount(); i++)
{
if(m_lst->GetCheck(i))
{
m_lst->DeleteItem(i);
i--;
}
}