LeftPaneView.cpp
上传用户:weimei12
上传日期:2022-08-11
资源大小:185k
文件大小:2k
- // LeftPaneView.cpp : implementation file
- //
- #include "stdafx.h"
- #include "SimpleMail.h"
- #include "LeftPaneView.h"
- // CLeftPaneView
- IMPLEMENT_DYNCREATE(CLeftPaneView, CFormView)
- CLeftPaneView::CLeftPaneView()
- : CFormView(CLeftPaneView::IDD)
- {
- }
- CLeftPaneView::~CLeftPaneView()
- {
- }
- void CLeftPaneView::DoDataExchange(CDataExchange* pDX)
- {
- CFormView::DoDataExchange(pDX);
- DDX_Control(pDX, IDC_TREE, m_treeCtrl);
- }
- BEGIN_MESSAGE_MAP(CLeftPaneView, CFormView)
- ON_WM_SIZE()
- ON_NOTIFY(TVN_SELCHANGED, IDC_TREE, &CLeftPaneView::OnTvnSelchangedTree)
- END_MESSAGE_MAP()
- // CLeftPaneView diagnostics
- #ifdef _DEBUG
- void CLeftPaneView::AssertValid() const
- {
- CFormView::AssertValid();
- }
- #ifndef _WIN32_WCE
- void CLeftPaneView::Dump(CDumpContext& dc) const
- {
- CFormView::Dump(dc);
- }
- #endif
- #endif //_DEBUG
- // CLeftPaneView message handlers
- void CLeftPaneView::OnSize(UINT nType, int cx, int cy)
- {
- CFormView::OnSize(nType, cx, cy);
- // TODO: Add your message handler code here
- if (GetSafeHwnd())
- {
- CRect rect;
- GetClientRect(&rect);
- if (m_treeCtrl.GetSafeHwnd())
- {
- m_treeCtrl.MoveWindow(&rect);
- }
- }
- }
- void CLeftPaneView::OnInitialUpdate()
- {
- CFormView::OnInitialUpdate();
- // TODO: Add your specialized code here and/or call the base class
- m_ImageList.Create(IDB_IMAGES, 16, 1, RGB(255, 0, 255));
- m_treeCtrl.SetImageList(&m_ImageList, LVSIL_NORMAL);
- HTREEITEM hRoot = m_treeCtrl.InsertItem(m_strRootName, 0, 0);
- HTREEITEM hRec = m_treeCtrl.InsertItem(_T("收件箱"), 1, 1, hRoot);
- m_treeCtrl.Expand(hRoot, TVE_EXPAND);
- m_treeCtrl.SelectItem(hRec);
- }
- void CLeftPaneView::OnTvnSelchangedTree(NMHDR *pNMHDR, LRESULT *pResult)
- {
- LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
- // TODO: Add your control notification handler code here
- *pResult = 0;
- }
- void CLeftPaneView::UpdateRootName(const CString& strRootName)
- {
- m_strRootName = strRootName;
- HTREEITEM hRoot = NULL;
- hRoot = m_treeCtrl.GetRootItem();
- m_treeCtrl.SetItemText(hRoot, m_strRootName);
- }