SplitterView.cpp
上传用户:weimei12
上传日期:2022-08-11
资源大小:185k
文件大小:2k
- // SplitterView.cpp : implementation file
- //
- #include "stdafx.h"
- #include "SimpleMail.h"
- #include "ListCtrlView.h"
- #include "EditCtrlView.h"
- #include "SplitterView.h"
- // CSplitterView
- IMPLEMENT_DYNCREATE(CSplitterView, CView)
- CSplitterView::CSplitterView()
- {
- m_pListCtrlView = NULL;
- m_pEditCtrlView = NULL;
- }
- CSplitterView::~CSplitterView()
- {
- }
- BEGIN_MESSAGE_MAP(CSplitterView, CView)
- ON_WM_CREATE()
- ON_WM_SIZE()
- END_MESSAGE_MAP()
- // CSplitterView drawing
- void CSplitterView::OnDraw(CDC* pDC)
- {
- CDocument* pDoc = GetDocument();
- // TODO: add draw code here
- }
- // CSplitterView diagnostics
- #ifdef _DEBUG
- void CSplitterView::AssertValid() const
- {
- CView::AssertValid();
- }
- #ifndef _WIN32_WCE
- void CSplitterView::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
- #endif
- #endif //_DEBUG
- // CSplitterView message handlers
- int CSplitterView::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if (CView::OnCreate(lpCreateStruct) == -1)
- return -1;
- // TODO: Add your specialized creation code here
- m_wndSplitter.CreateStatic(this, 2, 1);
- CCreateContext *pContext = (CCreateContext*) lpCreateStruct->lpCreateParams;
- if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CListCtrlView), CSize(150,0), pContext))
- {
- TRACE0("Failed to create listctrl viewn");
- return -1;
- }
-
- if (!m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CEditCtrlView), CSize(0,0), pContext))
- {
- TRACE0("Failed to create editctrl viewn");
- return -1;
- }
- m_pListCtrlView = (CListCtrlView*)(m_wndSplitter.GetPane(0, 0));
- m_pEditCtrlView = (CEditCtrlView*)m_wndSplitter.GetPane(1, 0);
-
- return 0;
- }
- void CSplitterView::OnSize(UINT nType, int cx, int cy)
- {
- CView::OnSize(nType, cx, cy);
- // TODO: Add your message handler code here
- m_wndSplitter.MoveWindow(0, 0, cx + 4, cy + 4);
- m_wndSplitter.SetRowInfo(0, cy - (cy / 4), 0);
- m_wndSplitter.SetRowInfo(1, cy / 4, 20);
- m_wndSplitter.RecalcLayout();
- }