gamehallframe.cpp
资源名称:1731.rar [点击查看]
上传用户:swkcbjrc
上传日期:2016-04-02
资源大小:45277k
文件大小:3k
源码类别:
游戏
开发平台:
Visual C++
- // gamehallframe.cpp : implementation file
- //
- #include "stdafx.h"
- #include "..GameHigh.h"
- #include "gamehallframe.h"
- #include "macros.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CGameHallFrame
- BEGIN_MESSAGE_MAP(CGameHallFrame, CFrameWnd)
- //{{AFX_MSG_MAP(CGameHallFrame)
- ON_WM_CREATE()
- ON_WM_PAINT()
- ON_WM_SIZE()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- CGameHallFrame::CGameHallFrame(CWnd* pWnd, RECT rcWnd)
- {
- pServerTreeView =NULL;
- pSystemMsgView =NULL;
- pWebAdvertView =NULL;
- bFirstRun =FALSE;
- try
- {
- Create(NULL, "",
- WS_CHILD | WS_VISIBLE, rcWnd, pWnd, NULL, NULL);
- }
- catch(...)
- {
- ::AfxMessageBox("无法创建大厅窗口", MB_OK | MB_ICONERROR);
- }
- }
- CGameHallFrame::~CGameHallFrame()
- {
- }
- /////////////////////////////////////////////////////////////////////////////
- // CGameHallFrame message handlers
- BOOL CGameHallFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
- {
- if (NULL == m_wndSplitter.CreateStatic(this, 1, 2))
- return FALSE;
- m_wndSplitter.CreateView(0, 1, //设置TreeView
- RUNTIME_CLASS(CHtmlViewEx),
- CSize(600,600),
- pContext);
- RECT rect;
- memset(&rect, 0, sizeof(RECT));
- this->GetClientRect(&rect);
- //拆分左边的栏
- if(NULL == m_wndLeftSplitter.CreateStatic(&m_wndSplitter,
- 2, 1,
- WS_CHILD|WS_VISIBLE,
- m_wndSplitter.IdFromRowCol(0, 0)))
- return FALSE;
- m_wndLeftSplitter.CreateView(0, 0, RUNTIME_CLASS(CServerTreeView),
- CSize(250,500), pContext);
- m_wndLeftSplitter.CreateView(1, 0, RUNTIME_CLASS(CSystemMsgView),
- CSize(250,100), pContext);
- SetActiveView((CView*)m_wndLeftSplitter.GetPane(0,0));
- pWebAdvertView =(CHtmlViewEx*)m_wndSplitter.GetPane(0, 1);
- pServerTreeView =(CServerTreeView*)m_wndLeftSplitter.GetPane(0, 0);
- pSystemMsgView =(CSystemMsgView*)m_wndLeftSplitter.GetPane(1, 0);
- SAFE_CHECKWND(pWebAdvertView)
- {
- pWebAdvertView->Navigate2("www.GameHigh.net", 0, NULL);
- }
- return TRUE;
- }
- int CGameHallFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
- return -1;
- this->ModifyStyleEx(WS_EX_OVERLAPPEDWINDOW , 0, 0);
- return 0;
- }
- void CGameHallFrame::OnPaint()
- {
- CPaintDC dc(this); // device context for painting
- if(!bFirstRun)
- {
- bFirstRun =TRUE;
- RECT rect;
- memset(&rect, 0, sizeof(RECT));
- this->GetClientRect(&rect);
- CSplitterWnd* pWnd =&m_wndSplitter;
- SAFE_CHECKWND(pWnd)
- {
- pWnd->SetColumnInfo(0, rect.right/4, 100);
- pWnd->SetColumnInfo(1, (rect.right/4) * 3, 100);
- pWnd->RecalcLayout();
- }
- }
- }
- void CGameHallFrame::OnSize(UINT nType, int cx, int cy)
- {
- CFrameWnd::OnSize(nType, cx, cy);
- }