⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 topsplitview.cpp

📁 一个OPC客户端监视程序
💻 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();	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -