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

📄 cppmdivoview.cpp

📁 本代码为使用vc平台开发stk软件x插件的一个范例。
💻 CPP
字号:
/******************************************************************************/
/*****       Copyright 2004-2004, Analytical Graphics, Incorporated.      *****/
/******************************************************************************/
// CPPMDIVOView.cpp : implementation of the CCPPMDIView class
//

#include "stdafx.h"
#include "CPPMDI.h"
#include "CPPMDIDoc.h"
#include "CPPMDIVOView.h"
#include "agpickinfodata.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

extern CCPPMDIApp theApp;

#define IDC_AXVO 1001

/////////////////////////////////////////////////////////////////////////////
// CCPPMDIVOView

IMPLEMENT_DYNCREATE(CCPPMDIVOView, CView)

BEGIN_MESSAGE_MAP(CCPPMDIVOView, CView)
	//{{AFX_MSG_MAP(CCPPMDIVOView)
	ON_WM_CREATE()
	ON_WM_SIZE()
	ON_COMMAND(ID_ZOOM_IN, OnZoomIn)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CCPPMDIVOView construction/destruction

CCPPMDIVOView::CCPPMDIVOView()
	: m_x(0), m_y(0)
{
	// TODO: add construction code here
}

CCPPMDIVOView::~CCPPMDIVOView()
{
}

BOOL CCPPMDIVOView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CTrashView drawing

void CCPPMDIVOView::OnDraw(CDC* pDC)
{
	CCPPMDIDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CCPPMDIVOView diagnostics

#ifdef _DEBUG
void CCPPMDIVOView::AssertValid() const
{
	CView::AssertValid();
}

void CCPPMDIVOView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CCPPMDIDoc* CCPPMDIVOView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCPPMDIDoc)));
	return (CCPPMDIDoc*)m_pDocument;
}
#endif //_DEBUG


/////////////////////////////////////////////////////////////////////////////
// CCPPMDIVOView message handlers

int CCPPMDIVOView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;

	RECT rectClient = { 0, 0, 50, 50 };	// VO Control will get resized in CCPPMDIVOView::OnSize()

	if (!m_AxVO.Create(NULL, WS_VISIBLE, rectClient, this, IDC_AXVO))
	{
		DestroyWindow();
		return -1;
	}

	return 0;
}

void CCPPMDIVOView::OnSize(UINT nType, int cx, int cy) 
{
	CView::OnSize(nType, cx, cy);

	RECT rectClient;
	GetClientRect(&rectClient);

	m_AxVO.MoveWindow(&rectClient);		// Make VO Control take up entire view
}


/////////////////////////////////////////////////////////////////////////////
// m_AxVO message handlers


BEGIN_EVENTSINK_MAP(CCPPMDIVOView, CView)
    //{{AFX_EVENTSINK_MAP(CCPPMDIVOView)
	ON_EVENT(CCPPMDIVOView, IDC_AXVO, -600 /* Click */, OnAxVOClick, VTS_NONE)
	ON_EVENT(CCPPMDIVOView, IDC_AXVO, -606 /* MouseMove */, OnAxVOMouseMove, VTS_I2 VTS_I2 VTS_I4 VTS_I4)
	ON_EVENT(CCPPMDIVOView, IDC_AXVO, -602 /* KeyDown */, OnAxVOKeyDown, VTS_PI2 VTS_I2)
	ON_EVENT(CCPPMDIVOView, IDC_AXVO, -603 /* KeyPress */, OnAxVOKeyPress, VTS_PI2)
	ON_EVENT(CCPPMDIVOView, IDC_AXVO, -604 /* KeyUp */, OnAxVOKeyUp, VTS_PI2 VTS_I2)
	ON_EVENT(CCPPMDIVOView, IDC_AXVO, -601 /* DblClick */, OnAxVODblClick, VTS_NONE)
	ON_EVENT(CCPPMDIVOView, IDC_AXVO, -605 /* MouseDown */, OnAxVOMouseDown, VTS_I2 VTS_I2 VTS_I4 VTS_I4)
	ON_EVENT(CCPPMDIVOView, IDC_AXVO, -607 /* MouseUp */, OnAxVOMouseUp, VTS_I2 VTS_I2 VTS_I4 VTS_I4)
	//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()


void CCPPMDIVOView::OnAxVOClick()
{
}

void CCPPMDIVOView::OnAxVOMouseMove(short Button, short Shift, long x, long y) 
{
}

void CCPPMDIVOView::OnAxVOKeyDown(short FAR* KeyCode, short Shift) 
{
}

void CCPPMDIVOView::OnAxVOKeyPress(short FAR* KeyAscii) 
{
}

void CCPPMDIVOView::OnAxVOKeyUp(short FAR* KeyCode, short Shift) 
{
}

// When a user double clicks, update the message viewer window with
// the selected object, latitude, etc.  The mouse coords are set
// right before this is called in OnAxVOMouseDown()
void CCPPMDIVOView::OnAxVODblClick() 
{
	theApp.m_MsgViewDlg.AddMessage(m_AxVO.PickInfo(m_x, m_y));
}

void CCPPMDIVOView::OnAxVOMouseDown(short Button, short Shift, long x, long y) 
{
	m_x = x;
	m_y = y;
}

void CCPPMDIVOView::OnAxVOMouseUp(short Button, short Shift, long x, long y) 
{
}

void CCPPMDIVOView::OnZoomIn() 
{
    m_AxVO.ZoomIn();
}

/******************************************************************************/
/*****       Copyright 2004-2004, Analytical Graphics, Incorporated.      *****/
/******************************************************************************/

⌨️ 快捷键说明

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