MFC 窗口自动填充 消息Onsize()
void CRightView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
// TODO: 在此处添加消息处理程序代码
CSize sizeTotal;
sizeTotal.cx = cx;
sizeTotal.cy = cy;
SetScrollSizes(MM_TEXT, sizeTotal);
if (m_MsgLogList.m_hWnd)
{
CRect rect;
m_MsgLogList.GetWindowRect(rect);
ScreenToClient(rect);
rect.right = cx - rect.left;
rect.bottom = cy - rect.left;
m_MsgLogList.MoveWindow(rect);
}
}
CListCtrl的使用:
CListCtrl m_CmdSiteListCtrl;
CListCtrl m_OpSiteListCtrl;
void CLeftView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
DDX_Control(pDX, IDC_COMMANDER_SITE_LIST, m_CmdSiteListCtrl);
DDX_Control(pDX, IDC_OPERATION_SITE_LIST, m_OpSiteListCtrl);
}
void CRightView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// TODO: 在此添加专用代码和/或调用基类
//GetParentFrame()->RecalcLayout();
//ResizeParentToFit();
//CRect rect;
m_MsgLogList.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
//m_MsgLogList.GetWindowRect(&rect);
m_MsgLogList.InsertColumn(0, _T(""), LVCFMT_LEFT, 22, 0);
m_MsgLogList.InsertColumn(1, _T("时间"), LVCFMT_LEFT, 160, 1);
m_MsgLogList.InsertColumn(2, _T("信息"), LVCFMT_LEFT, 600, 2);
//m_MsgLogList.SetImageList(m_pImgIconList, LVSIL_SMALL);
//OutputInfo(_T("中转服务器启动"));
}