MFC 常用控件的一般设置

设置CListCtrl网格线

if(m_ctrlListRecords.GetSafeHwnd()){
m_ctrlListRecords.m_bVisualManagerStyle = true;
m_ctrlListRecords.SetExtendedStyle( m_ctrlListRecords.GetExtendedStyle() 
| LVS_EX_FULLROWSELECT 
| LVS_EX_GRIDLINES); 
CRect rect;
m_ctrlListRecords.GetWindowRect(&rect);
ScreenToClient(&rect);
int nWidth = rect.Width();


m_ctrlListRecords.InsertColumn(0,_T("序号"),LVCFMT_CENTER,nWidth / 4.0);
m_ctrlListRecords.InsertColumn(1,_T("时间"),LVCFMT_CENTER,nWidth*3 / 4.0);
}


POSITION ps = list.GetHeadPosition();
while(ps){
record = list.GetNext(ps);
CString sText;
sText.Format(_T("%d"),i+1);
m_ctrlListRecords.InsertItem(i,sText);
m_ctrlListRecords.SetItemText(i++,1,record.m_dtTime.Format(_T("%Y-%m-%d %H:%M:%S")));
}

阅读更多
文章标签: MFC 控件
个人分类: C++
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭