【毕业论文】基于VC的图的遍历算法的动态演示系统的设计与实现 下载本文

// 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 // 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)

//{{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) CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CCreatGraphDlg)

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

//{{AFX_DATA_INIT(CCreatGraphDlg) //}}AFX_DATA_INIT

// NOTE: the ClassWizard will add member initialization here : CDialog(CCreatGraphDlg::IDD, pParent)

//}}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 // TODO: Add your control notification handler code here if(m_pCreatWnd->m_Status != 'V') { }

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

}

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();