?? shendayongview.cpp
字號:
// ShendayongView.cpp : implementation of the CShendayongView class
//
#include "stdafx.h"
#include "Shendayong.h"
#include "ShendayongDoc.h"
#include "ShendayongView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CShendayongView
IMPLEMENT_DYNCREATE(CShendayongView, CView)
BEGIN_MESSAGE_MAP(CShendayongView, CView)
//{{AFX_MSG_MAP(CShendayongView)
ON_WM_CREATE()
ON_WM_SIZE()
ON_WM_SETFOCUS()
ON_COMMAND(ID_FILEOPEN_GST, OnFileopenGst)
ON_COMMAND(ID_ZOOMIN, OnZoomin)
ON_COMMAND(ID_ZOOMOUT, OnZoomout)
ON_COMMAND(ID_PAN, OnPan)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CShendayongView construction/destruction
CShendayongView::CShendayongView()
{
// TODO: add construction code here
}
CShendayongView::~CShendayongView()
{
}
BOOL CShendayongView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CShendayongView drawing
void CShendayongView::OnDraw(CDC* pDC)
{
CShendayongDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CShendayongView printing
BOOL CShendayongView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CShendayongView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CShendayongView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CShendayongView diagnostics
#ifdef _DEBUG
void CShendayongView::AssertValid() const
{
CView::AssertValid();
}
void CShendayongView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CShendayongDoc* CShendayongView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CShendayongDoc)));
return (CShendayongDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CShendayongView message handlers
int CShendayongView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
//創建MAPX控件
if(!m_ctrlMapX.Create(NULL,WS_VISIBLE,CRect(0,0,100,100),this,IDC_MAP))
return -1;
// m_ctrlMapX.CreateCustomTool(TOOL_DISTANCE,miToolTypePoly, miCrossCursor);
// return 0;
return 0;
}
void CShendayongView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
if(cx !=0 && cy != 0)
m_ctrlMapX.MoveWindow(0,0,cx,cy,true);
}
void CShendayongView::OnSetFocus(CWnd* pOldWnd)
{
CView::OnSetFocus(pOldWnd);
// TODO: Add your message handler code here
m_ctrlMapX.SetFocus();
}
static char BASED_CODE szTabFilter[] = "MapInfo Map Files (*.gst)|*.gst|All Files (*.*)|*.*||";
void CShendayongView::OnFileopenGst()
{
// TODO: Add your command handler code here
CFileDialog dlgFile(TRUE, "*.gst", NULL, 0, szTabFilter, this);
dlgFile.m_ofn.lpstrTitle = "Open MapInfo Tables";
OSVERSIONINFO vers;
vers.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (GetVersionEx(&vers)) {
if (vers.dwMajorVersion < 4 && vers.dwPlatformId == VER_PLATFORM_WIN32_NT) {
// no multiple select
}
else {
dlgFile.m_ofn.Flags |= OFN_ALLOWMULTISELECT;
}
}
if (dlgFile.DoModal() == IDCANCEL)
return;
try {
POSITION pos = dlgFile.GetStartPosition();
CString strFile;
while (pos) {
strFile = dlgFile.GetNextPathName(pos);
m_ctrlMapX.SetGeoSet(strFile);
}
}
catch (COleDispatchException *e) {
e->ReportError();
e->Delete();
}
catch (COleException *e) {
e->ReportError();
e->Delete();
}
m_bGSTFileOpen = true ;
}
void CShendayongView::OnZoomin()
{
// TODO: Add your command handler code here
m_ctrlMapX.SetCurrentTool(miZoomInTool);
}
void CShendayongView::OnZoomout()
{
// TODO: Add your command handler code here
m_ctrlMapX.SetCurrentTool(miZoomOutTool);
}
void CShendayongView::OnPan()
{
// TODO: Add your command handler code here
m_ctrlMapX.SetCurrentTool(miPanTool);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -