gamehallframe.cpp
上传用户:swkcbjrc
上传日期:2016-04-02
资源大小:45277k
文件大小:3k
源码类别:

游戏

开发平台:

Visual C++

  1. // gamehallframe.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "..GameHigh.h"
  5. #include "gamehallframe.h"
  6. #include "macros.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CGameHallFrame
  14. BEGIN_MESSAGE_MAP(CGameHallFrame, CFrameWnd)
  15. //{{AFX_MSG_MAP(CGameHallFrame)
  16. ON_WM_CREATE()
  17. ON_WM_PAINT()
  18. ON_WM_SIZE()
  19. //}}AFX_MSG_MAP
  20. END_MESSAGE_MAP()
  21. CGameHallFrame::CGameHallFrame(CWnd* pWnd, RECT rcWnd)
  22. {
  23. pServerTreeView =NULL;
  24. pSystemMsgView =NULL;
  25. pWebAdvertView =NULL;
  26. bFirstRun =FALSE;
  27. try
  28. {
  29. Create(NULL, "", 
  30. WS_CHILD | WS_VISIBLE, rcWnd, pWnd, NULL, NULL);
  31. }
  32. catch(...)
  33. {
  34. ::AfxMessageBox("无法创建大厅窗口", MB_OK | MB_ICONERROR);
  35. }
  36. }
  37. CGameHallFrame::~CGameHallFrame()
  38. {
  39. }
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CGameHallFrame message handlers
  42. BOOL CGameHallFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
  43. {
  44. if (NULL == m_wndSplitter.CreateStatic(this, 1, 2))
  45. return FALSE;
  46. m_wndSplitter.CreateView(0, 1, //设置TreeView
  47. RUNTIME_CLASS(CHtmlViewEx),
  48. CSize(600,600),
  49. pContext); 
  50. RECT rect;
  51. memset(&rect, 0, sizeof(RECT));
  52. this->GetClientRect(&rect);
  53. //拆分左边的栏
  54. if(NULL == m_wndLeftSplitter.CreateStatic(&m_wndSplitter,
  55. 2, 1,
  56. WS_CHILD|WS_VISIBLE,
  57. m_wndSplitter.IdFromRowCol(0, 0))) 
  58. return FALSE;
  59. m_wndLeftSplitter.CreateView(0, 0, RUNTIME_CLASS(CServerTreeView),
  60. CSize(250,500), pContext);
  61. m_wndLeftSplitter.CreateView(1, 0, RUNTIME_CLASS(CSystemMsgView),
  62. CSize(250,100), pContext);
  63. SetActiveView((CView*)m_wndLeftSplitter.GetPane(0,0));
  64. pWebAdvertView =(CHtmlViewEx*)m_wndSplitter.GetPane(0, 1);
  65. pServerTreeView =(CServerTreeView*)m_wndLeftSplitter.GetPane(0, 0);
  66. pSystemMsgView =(CSystemMsgView*)m_wndLeftSplitter.GetPane(1, 0);
  67. SAFE_CHECKWND(pWebAdvertView)
  68. {
  69. pWebAdvertView->Navigate2("www.GameHigh.net", 0, NULL);
  70. }
  71. return TRUE;
  72. }
  73. int CGameHallFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
  74. {
  75. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  76. return -1;
  77. this->ModifyStyleEx(WS_EX_OVERLAPPEDWINDOW , 0, 0);
  78. return 0;
  79. }
  80. void CGameHallFrame::OnPaint() 
  81. {
  82. CPaintDC dc(this); // device context for painting
  83. if(!bFirstRun)
  84. {
  85. bFirstRun =TRUE;
  86. RECT rect;
  87. memset(&rect, 0, sizeof(RECT));
  88. this->GetClientRect(&rect);
  89. CSplitterWnd* pWnd =&m_wndSplitter;
  90. SAFE_CHECKWND(pWnd)
  91. {
  92. pWnd->SetColumnInfo(0, rect.right/4, 100);
  93. pWnd->SetColumnInfo(1, (rect.right/4) * 3, 100);
  94. pWnd->RecalcLayout();
  95. }
  96. }
  97. }
  98. void CGameHallFrame::OnSize(UINT nType, int cx, int cy) 
  99. {
  100. CFrameWnd::OnSize(nType, cx, cy);
  101. }