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

📄 primdlg.cpp

📁 用于数据结构课程设计,双向链表,并且用了MFC做图形界面
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// primDlg.cpp : implementation file
//

#include "stdafx.h"
#include "prim.h"
#include "primDlg.h"
#include "vex.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPrimDlg dialog

CPrimDlg::CPrimDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPrimDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPrimDlg)
	m_show = _T("");
	m_w1 = 0.0f;
	m_w10 = 0.0f;
	m_w2 = 0.0f;
	m_w3 = 0.0f;
	m_w4 = 0.0f;
	m_w5 = 0.0f;
	m_w6 = 0.0f;
	m_w7 = 0.0f;
	m_w8 = 0.0f;
	m_w9 = 0.0f;
	m_cost = _T("");
	m_a1=0 ;
	m_a10 = 0;
	m_a2 = 0;
	m_a3 = 0;
	m_a4 = 0;
	m_a5 = 0;
	m_a6 = 0;
	m_a7 = 0;
	m_a8 = 0;
	m_a9 = 0;
	m_b1 = 0;
	m_b10 = 0;
	m_b2 = 0;
	m_b3 = 0;
	m_b4 = 0;
	m_b5 = 0;
	m_b6 = 0;
	m_b7 = 0;
	m_b8 = 0;
	m_b9 = 0;
	m_v1 = 0;
	m_v10 = 0;
	m_v2 = 0;
	m_v3 = 0;
	m_v4 = 0;
	m_v5 = 0;
	m_v6 = 0;
	m_v7 = 0;
	m_v8 = 0;
	m_v9 = 0;
	m_a11 = 0;
	m_a12 = 0;
	m_a13 = 0;
	m_a14 = 0;
	m_a15 = 0;
	m_a16 = 0;
	m_a17 = 0;
	m_a18 = 0;
	m_a19 = 0;
	m_a20 = 0;
	m_b11 = 0;
	m_b12 = 0;
	m_b13 = 0;
	m_b14 = 0;
	m_b15 = 0;
	m_b16 = 0;
	m_b17 = 0;
	m_b18 = 0;
	m_b19 = 0;
	m_b20 = 0;
	m_w11 = 0.0f;
	m_w12 = 0.0f;
	m_w13 = 0.0f;
	m_w14 = 0.0f;
	m_w15 = 0.0f;
	m_w16 = 0.0f;
	m_w17 = 0.0f;
	m_w18 = 0.0f;
	m_w19 = 0.0f;
	m_w20 = 0.0f;
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CPrimDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPrimDlg)
	DDX_Text(pDX, IDC_SHOW, m_show);
	DDX_Text(pDX, IDC_W1, m_w1);
	DDX_Text(pDX, IDC_W10, m_w10);
	DDX_Text(pDX, IDC_W2, m_w2);
	DDX_Text(pDX, IDC_W3, m_w3);
	DDX_Text(pDX, IDC_W4, m_w4);
	DDX_Text(pDX, IDC_W5, m_w5);
	DDX_Text(pDX, IDC_W6, m_w6);
	DDX_Text(pDX, IDC_W7, m_w7);
	DDX_Text(pDX, IDC_W8, m_w8);
	DDX_Text(pDX, IDC_W9, m_w9);
	DDX_Text(pDX, IDC_A1, m_a1);
	DDX_Text(pDX, IDC_A10, m_a10);
	DDX_Text(pDX, IDC_A2, m_a2);
	DDX_Text(pDX, IDC_A3, m_a3);
	DDX_Text(pDX, IDC_A4, m_a4);
	DDX_Text(pDX, IDC_A5, m_a5);
	DDX_Text(pDX, IDC_A6, m_a6);
	DDX_Text(pDX, IDC_A7, m_a7);
	DDX_Text(pDX, IDC_A8, m_a8);
	DDX_Text(pDX, IDC_A9, m_a9);
	DDX_Text(pDX, IDC_B1, m_b1);
	DDX_Text(pDX, IDC_B10, m_b10);
	DDX_Text(pDX, IDC_B2, m_b2);
	DDX_Text(pDX, IDC_B3, m_b3);
	DDX_Text(pDX, IDC_B4, m_b4);
	DDX_Text(pDX, IDC_B5, m_b5);
	DDX_Text(pDX, IDC_B6, m_b6);
	DDX_Text(pDX, IDC_B7, m_b7);
	DDX_Text(pDX, IDC_B8, m_b8);
	DDX_Text(pDX, IDC_B9, m_b9);
	DDX_Text(pDX, IDC_V1, m_v1);
	DDX_Text(pDX, IDC_V10, m_v10);
	DDX_Text(pDX, IDC_V2, m_v2);
	DDX_Text(pDX, IDC_V3, m_v3);
	DDX_Text(pDX, IDC_V4, m_v4);
	DDX_Text(pDX, IDC_V5, m_v5);
	DDX_Text(pDX, IDC_V6, m_v6);
	DDX_Text(pDX, IDC_V7, m_v7);
	DDX_Text(pDX, IDC_V8, m_v8);
	DDX_Text(pDX, IDC_V9, m_v9);
	DDX_Text(pDX, IDC_A11, m_a11);
	DDX_Text(pDX, IDC_A12, m_a12);
	DDX_Text(pDX, IDC_A13, m_a13);
	DDX_Text(pDX, IDC_A14, m_a14);
	DDX_Text(pDX, IDC_A15, m_a15);
	DDX_Text(pDX, IDC_A16, m_a16);
	DDX_Text(pDX, IDC_A17, m_a17);
	DDX_Text(pDX, IDC_A18, m_a18);
	DDX_Text(pDX, IDC_A19, m_a19);
	DDX_Text(pDX, IDC_A20, m_a20);
	DDX_Text(pDX, IDC_B11, m_b11);
	DDX_Text(pDX, IDC_B12, m_b12);
	DDX_Text(pDX, IDC_B13, m_b13);
	DDX_Text(pDX, IDC_B14, m_b14);
	DDX_Text(pDX, IDC_B15, m_b15);
	DDX_Text(pDX, IDC_B16, m_b16);
	DDX_Text(pDX, IDC_B17, m_b17);
	DDX_Text(pDX, IDC_B18, m_b18);
	DDX_Text(pDX, IDC_B19, m_b19);
	DDX_Text(pDX, IDC_B20, m_b20);
	DDX_Text(pDX, IDC_W11, m_w11);
	DDX_Text(pDX, IDC_W12, m_w12);
	DDX_Text(pDX, IDC_W13, m_w13);
	DDX_Text(pDX, IDC_W14, m_w14);
	DDX_Text(pDX, IDC_W15, m_w15);
	DDX_Text(pDX, IDC_W16, m_w16);
	DDX_Text(pDX, IDC_W17, m_w17);
	DDX_Text(pDX, IDC_W18, m_w18);
	DDX_Text(pDX, IDC_W19, m_w19);
	DDX_Text(pDX, IDC_W20, m_w20);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CPrimDlg, CDialog)
	//{{AFX_MSG_MAP(CPrimDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_INPUT, OnInput)
	ON_BN_CLICKED(IDC_ENTER, OnEnter)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPrimDlg message handlers

BOOL CPrimDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CPrimDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CPrimDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CPrimDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CPrimDlg::OnOK() 
{
	
	
}

void CPrimDlg::OnInput() 
{
	UpdateData(true);
    
	MGraph G;
	
   
	G.vexs[0]=m_v1;
	G.vexs[1]=m_v2;
	G.vexs[2]=m_v3;
	G.vexs[3]=m_v4;
    G.vexs[4]=m_v5;
    G.vexs[5]=m_v6;
    G.vexs[6]=m_v7;

⌨️ 快捷键说明

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