mfc 列表控件

经常使用的mfc控件:list control,记录下
 
  1. 首先将list control拖入到对话框中,然后命名ID,通过类向导,类型为control,控件变量名(m_showlist),  view改变为report报表形式
  2. 在xxxDlg.cpp::OnInitDialog()根据需要添加表头和表项内容
          eg:  
CRect rect;
m_showlist.GetClientRect(&rect);
m_showlist.SetExtendedStyle(m_showlist.GetExStyle() | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
//表头
m_showlist.InsertColumn(0,_T("身份证号"), LVCFMT_CENTER,rect.Width()/5,0);
m_showlist.InsertColumn(1,_T("姓名"), LVCFMT_CENTER,rect.Width()/5,1);
m_showlist.InsertColumn(2,_T("类型"), LVCFMT_CENTER,rect.Width()/5,2);
m_showlist.InsertColumn(3,_T("发证日期"), LVCFMT_CENTER,rect.Width()/5,3);
m_showlist.InsertColumn(4,_T("有效期"), LVCFMT_CENTER,rect.Width()/5,4);
//表项
  1. 然后通过函数 SetItemText 修改表格的内容
                  m_showlist.SetItemText(i, j, string);
                     其中,表示将第 i 列 第 j 行 内容改为 字符串 string 
                    例子:m_list_goods.SetItemText(1,2,_T("未拍卖"));

转载于:https://www.cnblogs.com/13062225wmx/p/7667540.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值