📄 linkgameexdlg.cpp
字号:
// LinKGameExDlg.cpp : implementation file
//
#include "stdafx.h"
#include "LinKGameEx.h"
#include "LinKGameExDlg.h"
#include "DlgLogin.h"
#include "DlgSetGame.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLinKGameExDlg dialog
CLinKGameExDlg::CLinKGameExDlg(CWnd* pParent /*=NULL*/)
: CDialog(CLinKGameExDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CLinKGameExDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CLinKGameExDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CLinKGameExDlg)
DDX_Control(pDX, IDC_AREALIST, m_AreaList);
DDX_Control(pDX, IDC_ROOMLIST, m_RoomList);
DDX_Control(pDX, IDC_GameType, m_GameType);
DDX_Control(pDX, IDC_WLYXLIST, m_WLYXList);
DDX_Control(pDX, IDC_XXYXLIST, m_XXYXList);
DDX_Control(pDX, IDC_WLDZLIST, m_WLDZList);
DDX_Control(pDX, IDC_QPYXLIST, m_QPYXList);
DDX_Control(pDX, IDC_DJYXLIST, m_DJYXList);
DDX_Control(pDX, IDC_BTNXXYX, m_BtnXXYX);
DDX_Control(pDX, IDC_BTNWLYX, m_BtnWLYX);
DDX_Control(pDX, IDC_BTNWLDZ, m_BtnWLDZ);
DDX_Control(pDX, IDC_BTNQPYX, m_BtnQPYX);
DDX_Control(pDX, IDC_BTNDJYX, m_BtnDJYX);
DDX_Control(pDX, IDC_GAMETAB, m_GameTab);
DDX_Control(pDX, IDC_BTNALERT, m_BtnAlert);
DDX_Control(pDX, IDC_BTNBACK, m_BtnBack);
DDX_Control(pDX, IDC_BTNGAME, m_BtnGame);
DDX_Control(pDX, IDC_BTNSENDCHAT, m_BtnSendChat);
DDX_Control(pDX, IDC_BTNSENDMSG, m_BtnSendMsg);
DDX_Control(pDX, IDC_BTNTIREN, m_BtnTiRen);
DDX_Control(pDX, IDC_EDITCHAT, m_EditChat);
DDX_Control(pDX, IDC_MYCHATLIST, m_MyChatList);
DDX_Control(pDX, IDC_ALLCHATLIST, m_AllChatList);
DDX_Control(pDX, IDC_TAB, m_Tab);
DDX_Control(pDX, IDC_LinKIE, m_LinKIE);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CLinKGameExDlg, CDialog)
//{{AFX_MSG_MAP(CLinKGameExDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_TIMER()
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB, OnSelchangeTab)
ON_BN_CLICKED(IDC_BTNTEST, OnBtntest)
ON_BN_CLICKED(IDC_BTNBACK, OnBtnback)
ON_BN_CLICKED(IDC_BTNSENDCHAT, OnBtnsendchat)
ON_NOTIFY(TCN_SELCHANGE, IDC_GAMETAB, OnSelchangeGametab)
ON_BN_CLICKED(IDC_BTNWLDZ, OnBtnwldz)
ON_BN_CLICKED(IDC_BTNWLYX, OnBtnwlyx)
ON_BN_CLICKED(IDC_BTNQPYX, OnBtnqpyx)
ON_BN_CLICKED(IDC_BTNDJYX, OnBtndjyx)
ON_BN_CLICKED(IDC_BTNXXYX, OnBtnxxyx)
ON_NOTIFY(NM_CLICK, IDC_WLDZLIST, OnClickWldzlist)
ON_NOTIFY(NM_CLICK, IDC_WLYXLIST, OnClickWlyxlist)
ON_NOTIFY(NM_CLICK, IDC_QPYXLIST, OnClickQpyxlist)
ON_NOTIFY(NM_CLICK, IDC_DJYXLIST, OnClickDjyxlist)
ON_NOTIFY(NM_CLICK, IDC_XXYXLIST, OnClickXxyxlist)
ON_NOTIFY(NM_DBLCLK, IDC_ROOMLIST, OnDblclkRoomlist)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLinKGameExDlg message handlers
BOOL CLinKGameExDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
this->ShowWindow( SW_SHOWMAXIMIZED/*SW_MAXIMIZE*/); // 最大化运行
this->m_ChkExit = FALSE;
this->SetTimer( 0, 500, NULL);
ResetLayout(); // 重新布局
InitControl(); // 初始化所有控件
//ChkUserName(); // 检测用户名称
return TRUE; // return TRUE unless you set the focus to a control
}
void CLinKGameExDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CLinKGameExDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CLinKGameExDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
BOOL CLinKGameExDlg::ChkUserName()
{
CDlgLogin m_DlgLogin;
switch(m_DlgLogin.DoModal())
{
case 0: // 注册
MessageBox( "Regist");
break;
case 1: // 找回密码
MessageBox( "FindPWD");
break;
case 2: // 登陆
MessageBox( this->m_UserName + "\n\n" + this->m_UserPWD );
break;
case 3: // 退出
this->m_ChkExit = TRUE;
break;
}
return TRUE;
}
void CLinKGameExDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
switch( nIDEvent)
{
case 0:
if( this->m_ChkExit) this->DestroyWindow();
break;
}
CDialog::OnTimer(nIDEvent);
}
void CLinKGameExDlg::ResetLayout()
{
/*
CRect m_RectMain;
this->GetWindowRect( &m_RectMain);
this->m_GameTree.MoveWindow( m_RectMain.left + 15, m_RectMain.top + 70, 250, m_RectMain.Height() - 50 - 60, 1);
CRect m_RectGameTree;
this->m_GameTree.GetWindowRect( &m_RectGameTree);
this->m_LinKIE.MoveWindow( m_RectGameTree.right + 5, m_RectGameTree.top - 25, 600, m_RectGameTree.Height(), 1);
this->m_Tab.MoveWindow( m_RectMain.Width()-280, m_RectGameTree.top - 25, 260, m_RectGameTree.Height(), 1);
*/
this->m_GameTab.MoveWindow( GAMETABLEFT, GAMETABTOP, GAMETABWIDTH, GAMETABHEIGHT, 1);
this->m_LinKIE.MoveWindow( LINKIELEFT, LINKIETOP, LINKIEWIDTH, LINKIEHEIGHT, 1);
this->m_Tab.MoveWindow(GRTABLEFT, GRTABTOP, GRTABWIDTH, GRTABHEIGHT, 1);
}
void CLinKGameExDlg::InitControl()
{
// 设置皮肤
SetWindowSkin( m_hWnd , "Dialog" );
SetDialogSkin("Dialog");
// 初始化GameTree
this->InitGameTab();
// 初始化GameType
this->InitGameType();
// 初始化web 浏览器
this->m_LinKIE.Navigate( _T("www.bdchina.com"), NULL, NULL, NULL, NULL);
// 区域列表
this->m_AreaList.MoveWindow( AREALISTLEFT, AREALISTTOP, AREALISTWIDTH, AREALISTHEIGHT, 1);
this->m_AreaList.ShowWindow(0);
// 初始化房间列表
this->m_RoomList.MoveWindow( ROOMLISTLEFT, ROOMLISTTOP, ROOMLISTWIDTH, ROOMLISTHEIGHT, 1);
InitRoomList();
this->m_RoomList.ShowWindow(0);
// 二级大厅信息显示部分
this->m_AllChatList.SetWindowText( "");
this->m_AllChatList.ShowWindow(0);
this->m_MyChatList.SetWindowText( "");
this->m_MyChatList.ShowWindow(0);
// 二级大厅功能按钮
this->m_EditChat.ShowWindow(0);
this->m_BtnSendChat.ShowWindow(0);
this->m_BtnAlert.ShowWindow(0);
this->m_BtnTiRen.ShowWindow(0);
this->m_BtnSendMsg.ShowWindow(0);
this->m_BtnGame.ShowWindow(0);
this->m_BtnBack.ShowWindow(0);
this->InitGRTab();
}
void CLinKGameExDlg::OnSelchangeTab(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
CTabCtrl* m_TabEx = (CTabCtrl *)this->GetDlgItem(IDC_TAB);
switch(m_TabEx->GetCurSel()) // 返回选中页数
{
case 0:
m_GR.ShowWindow(SW_SHOW);
m_ZD.ShowWindow(SW_HIDE);
m_TX.ShowWindow(SW_HIDE);
m_GG.ShowWindow(SW_HIDE);
break;
case 1:
m_GR.ShowWindow(SW_HIDE);
m_ZD.ShowWindow(SW_SHOW);
m_TX.ShowWindow(SW_HIDE);
m_GG.ShowWindow(SW_HIDE);
break;
case 2:
m_GR.ShowWindow(SW_HIDE);
m_ZD.ShowWindow(SW_HIDE);
m_TX.ShowWindow(SW_SHOW);
m_GG.ShowWindow(SW_HIDE);
break;
case 3:
m_GR.ShowWindow(SW_HIDE);
m_ZD.ShowWindow(SW_HIDE);
m_TX.ShowWindow(SW_HIDE);
m_GG.ShowWindow(SW_SHOW);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -