📄 miwindow.cpp
字号:
// MiWindow.cpp : implementation file
//
#include "stdafx.h"
#include "Gis.h"
#include "MiWindow.h"
#include "MyMapX.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMiWindow dialog
//进行事件处理
BEGIN_EVENTSINK_MAP(CMiWindow, CDialog)
//使用工具时的处理
// ON_EVENT(CMiWindow, ID_MINMAP,WM_PAINT,OnTPaint)//当刷新图的时候
END_EVENTSINK_MAP()
CMiWindow::CMiWindow(CWnd* pParent /*=NULL*/)
: CDialog(CMiWindow::IDD, pParent)
{
//{{AFX_DATA_INIT(CMiWindow)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_map = NULL;
}
void CMiWindow::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMiWindow)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMiWindow, CDialog)
//{{AFX_MSG_MAP(CMiWindow)
ON_WM_SIZE()
ON_WM_CREATE()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMiWindow message handlers
void CMiWindow::OnCancel()
{
ShowWindow(SW_HIDE);
//CDialog::OnCancel();
}
void CMiWindow::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
m_map->MoveWindow(0,0,cx,cy);
}
CMiWindow::~CMiWindow()
{
delete m_map;
}
int CMiWindow::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
m_map = new CMapX;//CMyMapX;
if(!m_map->Create(NULL,WS_VISIBLE,CRect(0,0,20,20),this,ID_MINMAP))
return -1;
return 0;
}
void CMiWindow::OnPaint()
{
CPaintDC dc(this); // device context for painting
//进行坐标转换
DrawEye();
m_map->Invalidate();
// Do not call CDialog::OnPaint() for painting messages
}
void CMiWindow::DrawEye()
{
float x,y,x1,y1;
CClientDC cdc(this);
// CPaintDC cdc(this);
m_map->ConvertCoord(&x,&y,&m_left,&m_top,miMapToScreen);
m_map->ConvertCoord(&x1,&y1,&m_right,&m_bottom,miMapToScreen);
//画出视窗范围
/* m_map->m_top = x;
m_map->m_left = y;
m_map->m_right = x1;
m_map->m_bottom = y1;
*/
m_map->Invalidate();
cdc.MoveTo(x,y);
cdc.LineTo(x,y1);
cdc.LineTo(x1,y1);
cdc.LineTo(x1,y);
cdc.LineTo(x,y);
}
void CMiWindow::OnTPaint()
{
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -