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

📄 sercltdlg.cpp

📁 井字棋
💻 CPP
字号:
// SerCltDlg.cpp : implementation file
//

#include "stdafx.h"
#include "JingZiQi.h"
#include "SerCltDlg.h"
#include "MainFrm.h"
#include "ConnectDlg.h"
#include "JingZiQiView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSerCltDlg dialog


CSerCltDlg::CSerCltDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSerCltDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSerCltDlg)
		// NOTE: the ClassWizard will add member initialization here
//	this->CheckRadioButton(IDC_RADIO1,IDC_RADIO2,IDC_RADIO2);
	//}}AFX_DATA_INIT
}


void CSerCltDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSerCltDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSerCltDlg, CDialog)
	//{{AFX_MSG_MAP(CSerCltDlg)
	ON_BN_CLICKED(IDC_OK, OnOk)
	ON_BN_CLICKED(IDC_Cancel, OnCancel)
	ON_WM_CLOSE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSerCltDlg message handlers

void CSerCltDlg::OnOk() 
{
	// TODO: Add your control notification handler code here
	CMainFrame *pFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;
	CJingZiQiView *pView=(CJingZiQiView*)(pFrame->GetActiveView()); 
	int rslt=GetCheckedRadioButton(IDC_RADIO1,IDC_RADIO2);
	if(rslt==IDC_RADIO1)
	{
		pView->IsServer=true;
		pFrame->SetNetwork();
		UpdateData();
	//	this->CloseWindow();
		this->OnCancel();
	}
	else
	{
//		CJingZiQiView *pView=(CJingZiQiView*)pFrame->GetActiveView(); 
		pView->IsServer=false;
		CConnectDlg ConnectDlg;
		if(ConnectDlg.DoModal()==IDOK)
		{
			pFrame->m_Server=ConnectDlg.m_DlgServer;
			pFrame->m_Port=ConnectDlg.m_DlgPort;
			pFrame->ConnectServer();
			UpdateData();
		//	this->CloseWindow();
			//DestroyWindow();
			this->OnCancel();
		}
	}
//	pView->mode=2;
}

BOOL CSerCltDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CheckRadioButton(IDC_RADIO1,IDC_RADIO2,IDC_RADIO2);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

/*void CSerCltDlg::OnCancel() 
{
	// TODO: Add your control notification handler code here
	OnClose();
}*/

void CSerCltDlg::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
//	this->DestroyWindow();
	CDialog::OnClose();
}

⌨️ 快捷键说明

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