📄 gamelistdlg.cpp
字号:
// GameListDlg.cpp : implementation file
//
#include "stdafx.h"
#include "WeiQiClient.h"
#include "GameListDlg.h"
#include "Client.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CGameListDlg dialog
CGameListDlg::CGameListDlg(CWnd* pParent /*=NULL*/)
: CDialog(CGameListDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CGameListDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CGameListDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGameListDlg)
DDX_Control(pDX, IDC_LIST_GAMELIST, m_GameList);
DDX_Control(pDX,IDC_BUTTON_YES,m_JoinButton);
DDX_Control(pDX,IDC_BUTTON_CANCEL,m_CancelButton);
DDX_Control(pDX,IDC_BUTTON_FLASH,m_FlashButton);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CGameListDlg, CDialog)
//{{AFX_MSG_MAP(CGameListDlg)
ON_BN_CLICKED(IDC_BUTTON_YES, OnButtonYes)
ON_BN_CLICKED(IDC_BUTTON_CANCEL, OnButtonCancel)
ON_BN_CLICKED(IDC_BUTTON_FLASH, OnButtonFlash)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGameListDlg message handlers
BOOL CGameListDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_JoinButton.LoadButtonBmp(IDB_BITMAPCREATE1,IDB_BITMAPCREATE2,IDB_BITMAPCREATE3,IDB_BITMAPCONNECTBK);
m_CancelButton.LoadButtonBmp(IDB_BITMAPEXIT1,IDB_BITMAPEXIT2,IDB_BITMAPEXIT3,IDB_BITMAPCONNECTBK);
m_FlashButton.LoadButtonBmp(IDB_BITMAPLIST1,IDB_BITMAPLIST2,IDB_BITMAPLIST3,IDB_BITMAPCONNECTBK);
m_Tip.Create(this);
m_Tip.AddTool(&m_JoinButton,_T("确定"));
m_Tip.AddTool(&m_CancelButton,_T("取消"));
m_Tip.AddTool(&m_FlashButton,_T("刷新"));
OnButtonFlash();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CGameListDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
m_Tip.RelayEvent(pMsg);
if(pMsg->message==WM_KEYDOWN&&pMsg->wParam==13)
{
OnButtonYes();
return TRUE;
}
return CDialog::PreTranslateMessage(pMsg);
}
void CGameListDlg::OnButtonYes()
{
// TODO: Add your control notification handler code here
int i=m_GameList.GetCurSel();
if(i!=LB_ERR)
{
m_GameList.GetText(i,m_Select);
OnOK();
}
else
MessageBox(_T("请选择游戏"));
}
void CGameListDlg::OnButtonCancel()
{
// TODO: Add your control notification handler code here
OnCancel();
}
void CGameListDlg::OnButtonFlash()
{
// TODO: Add your control notification handler code here
((CWeiQiClientApp*)AfxGetApp())->m_pClient->SendMsg(_T("_LISTGAME_"));
}
void CGameListDlg::SetListBox(PTSTR pMsg)
{
m_GameList.ResetContent();
int i=0,j=0;
TCHAR Name[20];
while(pMsg[i])
{
if(pMsg[i]==_T(' '))
{
Name[j]=0;
j=0;
m_GameList.AddString(Name);
i++;
}
Name[j]=pMsg[i];
i++;
j++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -