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

📄 thoice.cpp

📁 一个基于对话框的五子棋游戏,支持人机对战.
💻 CPP
字号:
// Thoice.cpp : implementation file
//

#include "stdafx.h"
#include "Wzq.h"
#include "Thoice.h"

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

/////////////////////////////////////////////////////////////////////////////
// CThoice dialog


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


void CThoice::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CThoice)
	DDX_Control(pDX, IDCANCEL2, m_cance);
	DDX_Control(pDX, IDCANCEL, m_ok);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CThoice, CDialog)
	//{{AFX_MSG_MAP(CThoice)
	ON_BN_CLICKED(IDCANCEL2, OnOK)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CThoice message handlers

BOOL CThoice::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	if(model==0)
	{
		CheckRadioButton(IDC_RADIO1, IDC_RADIO3,IDC_RADIO2);
	}
	else if(model==1)
	{
		CheckRadioButton(IDC_RADIO1, IDC_RADIO3,IDC_RADIO1);
	}
	else
		CheckRadioButton(IDC_RADIO1, IDC_RADIO3,IDC_RADIO3);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


int CThoice::SetModel()
{
   return model;
}

void CThoice::OnOK() 
{
	// TODO: Add your control notification handler code here
    int ID=GetCheckedRadioButton (IDC_RADIO1,IDC_RADIO3);
    if(ID==IDC_RADIO1)
		model=1;
	else if(ID==IDC_RADIO2)
		model=0;
	else 
		model=2;
	CDialog::OnOK();
}

void CThoice::GetModel(int m)
{
  model=m;
}

⌨️ 快捷键说明

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