dlgoneplayerscore.cpp

来自「◆◆◆ 《投掷飞镖记分工具》◆◆◆ 操作系统 : Windows Mobil」· C++ 代码 · 共 79 行

CPP
79
字号
// DlgOnePlayerScore.cpp : 实现文件
//

#include "stdafx.h"
#include "DartScore.h"
#include "DlgOnePlayerScore.h"


// CDlgOnePlayerScore 对话框

IMPLEMENT_DYNAMIC(CDlgOnePlayerScore, CDialogWM)

CDlgOnePlayerScore::CDlgOnePlayerScore(CWnd* pParent /*=NULL*/)
	: CDialogWM(CDlgOnePlayerScore::IDD, IDR_MENU_OnePlayerScore, pParent)
{

}

CDlgOnePlayerScore::~CDlgOnePlayerScore()
{
}

void CDlgOnePlayerScore::DoDataExchange(CDataExchange* pDX)
{
	CDialogWM::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CDlgOnePlayerScore, CDialogWM)
	ON_COMMAND(IDC_NEXT_DART, &CDlgOnePlayerScore::OnNextDart)
END_MESSAGE_MAP()


// CDlgOnePlayerScore 消息处理程序

void CDlgOnePlayerScore::OnNextDart()
{
	CString csText;
	GetDlgItemText ( IDC_EDIT_SCORE, csText );
	if ( csText.IsEmpty() )
	{
		AfxMessageBox ( _T("Score can't be empty") );
		return;
	}
	UINT nScore = GetDlgItemInt ( IDC_EDIT_SCORE, NULL, FALSE );
	m_UIntArray_Scores.Add ( nScore );
	if ( m_UIntArray_Scores.GetSize() >= g_AGameData.nDartNum )
	{
		CDialogWM::OnOK ();
		return;
	}
	ShowCurSoreIndex ();
	SetDlgItemText ( IDC_EDIT_SCORE, _T("") );
}

void CDlgOnePlayerScore::OnInit(void)
{
	CString csPlayerName;
	csPlayerName.Format ( _T("Player Name : %s"), m_csPlayerName );
	SetDlgItemText ( IDC_STATIC_PlayerName, csPlayerName );

	ShowCurSoreIndex ();

	CDialogWM::OnInit ();
}

void CDlgOnePlayerScore::ShowCurSoreIndex(void)
{
	CString csCurScoreIndex;
	csCurScoreIndex.Format ( _T("The NO.%d Dart"), m_UIntArray_Scores.GetSize() + 1 );
	SetDlgItemText ( IDC_STATIC_DartNO, csCurScoreIndex );
}

void CDlgOnePlayerScore::OnCancel ()
{
	if ( AfxMessageBox ( _T("Would you want to cancel score ?"), MB_ICONQUESTION|MB_YESNO ) != IDYES )
		return;
	CDialogWM::OnCancel ();
}

⌨️ 快捷键说明

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