【VC开源代码栏目提醒】:网学会员--在 VC开源代码编辑为广大网友搜集整理了:TopSplitView.cpp绩等信息,祝愿广大网友取得需要的信息,参考学习。
// TopSplitView.cpp : implementation file
//
#include "stdafx.h"
#include "OpcClientSpy.h"
#include "TopSplitView.h"
#include "ServerInfoView.h"
#include "ValueMsgView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTopSplitView
IMPLEMENT_DYNCREATE(CTopSplitView, CView)
CTopSplitView::CTopSplitView()
{
}
CTopSplitView::~CTopSplitView()
{
}
BEGIN_MESSAGE_MAP(CTopSplitView, CView)
//{{AFX_MSG_MAP(CTopSplitView)
ON_WM_CREATE()
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTopSplitView drawing
void CTopSplitView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
}
/////////////////////////////////////////////////////////////////////////////
// CTopSplitView diagnostics
#ifdef _DEBUG
void CTopSplitView::AssertValid() const
{
CView::AssertValid();
}
void CTopSplitView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTopSplitView message handlers
int CTopSplitView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
m_leftRightSplitter.CreateStatic(this, 1, 2);
CCreateContext *pContext = (CCreateContext*) lpCreateStruct->lpCreateParams;
CRect rect;
GetWindowRect(&rect);
m_leftRightSplitter.CreateView(0,0,RUNTIME_CLASS(CServerInfoView), CSize(rect.Width()/3,0), pContext);
m_leftRightSplitter.CreateView(0,1,RUNTIME_CLASS(CValueMsgView), CSize(0,0), pContext);
return 0;
}
void CTopSplitView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
//去掉视图中的边框
//不是用m_leftRightSplitter.MoveWindow(0,0,cx,cy);
m_leftRightSplitter.MoveWindow(-2,-2,cx+4,cy+4);
//下面这段代码放在OnCreate中不起作用。
m_leftRightSplitter.SetColumnInfo(0, cx/3, 0);
m_leftRightSplitter.SetColumnInfo(1, cx-cx/3, 20);
m_leftRightSplitter.RecalcLayout();
}