基于vc++的图的遍历算法的动态演示系统的设计与实现(含源文件)(5)

2019-04-14 10:11

第三章 系统实现

3.1 DFSearch.cpp和DFSearch.h的实现

// DFSearch.cpp : Defines the class behaviors for the application. //

#include \#include \#include \#ifdef _DEBUG

#define new DEBUG_NEW #undef THIS_FILE

static char THIS_FILE[] = __FILE__; #endif CDFSearchApp

BEGIN_MESSAGE_MAP(CDFSearchApp, CWinApp)

//{{AFX_MSG_MAP(CDFSearchApp)

// NOTE - the ClassWizard will add and remove mapping macros // DO NOT EDIT what you see in these blocks of generated

here. code!

//}}AFX_MSG

ON_COMMAND(ID_HELP, CWinApp::OnHelp)

END_MESSAGE_MAP() // CDFSearchApp construction CDFSearchApp::CDFSearchApp() { }

// The one and only CDFSearchApp object CDFSearchApp theApp;

18

// TODO: add construction code here,

// Place all significant initialization in InitInstance

// CDFSearchApp initialization BOOL CDFSearchApp::InitInstance() { }

3.2 CreatGraphDlg.cpp和CreatGraphDlg.h的实现 // CreatGraphDlg.cpp : implementation file #include \标准AFX头文件 #include \#include \#ifdef _DEBUG

#define new DEBUG_NEW

19

// Standard initialization

// If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. CDFSearchDlg dlg; m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse == IDOK) { }

else if (nResponse == IDCANCEL) { }

// Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE;

// TODO: Place code here to handle when the dialog is // dismissed with Cancel // dismissed with OK

// TODO: Place code here to handle when the dialog is

#undef THIS_FILE

static char THIS_FILE[] = __FILE__; #endif

//这是表示,如果生成调试版本,要指示当前文件的名称。__FILE__是一个

宏,在编译器编译过程中给它赋值为当前正在编译的文件名称

// CCreatGraphDlg dialog

CCreatGraphDlg::CCreatGraphDlg(CWnd* pParent /*=NULL*/) { }

CCreatGraphDlg::~CCreatGraphDlg() { }

void CCreatGraphDlg::DoDataExchange(CDataExchange* pDX) { }

//通过宏定义为类添加一个消息,处理函数对组成的数组 BEGIN_MESSAGE_MAP(CCreatGraphDlg, CDialog)

: CDialog(CCreatGraphDlg::IDD, pParent) //{{AFX_DATA_INIT(CCreatGraphDlg) //}}AFX_DATA_INIT

// NOTE: the ClassWizard will add member initialization here

delete m_pCreatWnd;

CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CCreatGraphDlg)

// NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP

//{{AFX_MSG_MAP(CCreatGraphDlg)

ON_BN_CLICKED(ID_EDIT_POINT, OnEditPoint) ON_BN_CLICKED(ID_EDIT_EDGE, OnEditEdge) ON_BN_CLICKED(ID_SHOW_GRAPH, OnShowGraph) ON_BN_CLICKED(ID_OK, OnOk)

20

//}}AFX_MSG_MAP

END_MESSAGE_MAP()

// CCreatGraphDlg message handlers

BOOL CCreatGraphDlg::OnInitDialog() //调用这个成员函数是对WM_INITDIALOG消息作出的反应。

//这条消息是在对话框即将显示之前,在Create,CreateIndirect或DoModal

调用期间发出的。

{ }

void CCreatGraphDlg::OnEditPoint() //编辑点函数,用于在鼠标在图上单机,

就自动创捷结点

CDialog::OnInitDialog();

// TODO: Add extra initialization here

m_pCreatWnd= new CMoveWnd(IDC_GRAPH_CREAT, m_G); m_pCreatWnd->Create(NULL,NULL,WS_CHILD|WS_VISIBLE,recreturn TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return

RECT rect;

t,this,0,NULL);

FALSE

{ }

void CCreatGraphDlg::OnEditEdge() //编辑弧度函数 {

// TODO: Add your control notification handler code here if(m_pCreatWnd->m_Status != 'V') { }

m_pCreatWnd->m_Status = 'V'; m_pCreatWnd->Invalidate();

// TODO: Add your control notification handler code here

21

}

if(m_pCreatWnd->m_Status != 'E') { }

m_pCreatWnd->m_Status = 'E'; m_pCreatWnd->m_From = TRUE; m_pCreatWnd->Invalidate();

void CCreatGraphDlg::OnShowGraph() //该函数用于显示一个图表 { }

void CCreatGraphDlg::OnOk() //OnOk是当用户按OK按钮(ID是IDOK)时

调用。覆盖该函数执行OK按钮动作。

// TODO: Add your control notification handler code here if(m_pCreatWnd->m_Status != 'D') { m_pCreatWnd->m_Status = 'D'; }

m_pCreatWnd->ChangeDWnd(); m_pCreatWnd->m_From = TRUE; m_pCreatWnd->Invalidate();

{ }

void CCreatGraphDlg::OnCancel() //当用户在模态对话框或非模态对话框内

单击Cancel按钮或按ESC键时,窗体调用这个成员函数

// TODO: Add your control notification handler code here CDialog::OnOK();

{ }

// TODO: Add extra cleanup here CDialog::OnCancel();

22


基于vc++的图的遍历算法的动态演示系统的设计与实现(含源文件)(5).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:餐饮业客户关系管理研究

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: