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

📄 mapwnd.cpp

📁 模式识别中的寻路算法:A星算法的实现及简单应用
💻 CPP
字号:
// MapWnd.cpp : 实现文件
//

#include "stdafx.h"
#include "AStar.h"
#include "MapWnd.h"
#include ".\mapwnd.h"


// CMapWnd 对话框

IMPLEMENT_DYNAMIC(CMapWnd, CDialog)
CMapWnd::CMapWnd(CWnd* pParent /*=NULL*/)
	: CDialog(CMapWnd::IDD, pParent)
{

}

CMapWnd::~CMapWnd()
{
}

void CMapWnd::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CMapWnd, CDialog)
	ON_WM_NCLBUTTONDOWN()
	ON_WM_NCRBUTTONDOWN()
END_MESSAGE_MAP()


// CMapWnd 消息处理程序

void CMapWnd::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值

    int x=point.x;
	int y=point.y;
	MessageBox("x,y");
	CDialog::OnNcLButtonDown(nHitTest, point);
}

void CMapWnd::OnNcRButtonDown(UINT nHitTest, CPoint point)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值

	CDialog::OnNcRButtonDown(nHitTest, point);
}

bool CMapWnd::InitMap(CWnd* pmap)
{		   
	CClientDC dc(pmap);
	CRect maprect;
	pmap->GetClientRect(&maprect);
	int dx=maprect.Width()/8;
	int dy=maprect.Height()/8;
	for(int i=1;i<=8;i++)
	{
		dc.MoveTo(0,dy*i);
		dc.LineTo(maprect.Width(),dy*i);
		dc.MoveTo(dx*i,0);
		dc.LineTo(dx*i,maprect.Height());
	}
	return false;
}

⌨️ 快捷键说明

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