clsselect.cpp

来自「利用MFC,实现投票系统」· C++ 代码 · 共 78 行

CPP
78
字号
// clsSelect.cpp : implementation file
//

#include "stdafx.h"
#include "ballot.h"
#include "clsSelect.h"
#include "ballot.h"
#include "clsBallot.h"


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

/////////////////////////////////////////////////////////////////////////////
// clsSelect dialog


clsSelect::clsSelect(CWnd* pParent /*=NULL*/)
	: CDialog(clsSelect::IDD, pParent)
{
	//{{AFX_DATA_INIT(clsSelect)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void clsSelect::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(clsSelect)
	DDX_Control(pDX, IDC_LIST1, m_List_Select);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(clsSelect, CDialog)
	//{{AFX_MSG_MAP(clsSelect)
	ON_BN_CLICKED(IDOK, OnBack)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// clsSelect message handlers

void clsSelect::OnBack() 
{
	clsBallot show;
	CDialog::OnCancel();
    show.DoModal();
}




BOOL clsSelect::OnInitDialog() 
{
	CStdioFile readFile;
	CString    strText;
	CDialog::OnInitDialog();
    m_List_Select.ResetContent();//清除列表框中的所有数据
	if(readFile.Open("data.dat",CStdioFile::modeRead | CStdioFile::typeText)==TRUE)
	{
		while(readFile.ReadString(strText))
		{
			m_List_Select.AddString(strText);
		}
		readFile.Close();
	}	
	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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