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

游戏

开发平台:

Visual C++

  1. // showipwnd.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "..GameHigh.h"
  5. #include "..includeshowipwnd.h"
  6. #include "baseFunction.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CShowIpWnd
  14. CShowIpWnd::CShowIpWnd()
  15. {
  16. }
  17. CShowIpWnd::~CShowIpWnd()
  18. {
  19. }
  20. BEGIN_MESSAGE_MAP(CShowIpWnd, CWnd)
  21. //{{AFX_MSG_MAP(CShowIpWnd)
  22. ON_WM_PAINT()
  23. ON_WM_ERASEBKGND()
  24. //}}AFX_MSG_MAP
  25. END_MESSAGE_MAP()
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CShowIpWnd message handlers
  28. void CShowIpWnd::OnPaint() 
  29. {
  30. CPaintDC dc(this); // device context for painting
  31. CBrush m_Brush;
  32. COLORREF clrBk =RGB(124, 176, 201);
  33. m_Brush.CreateSolidBrush(clrBk);
  34. RECT rect;
  35. memset(&rect, 0, sizeof(RECT));
  36. this->GetClientRect(&rect);
  37. dc.FillRect(&rect, &m_Brush);
  38. m_Brush.DeleteObject();
  39. LOGBRUSH lb;
  40. memset(&lb, 0, sizeof(LOGBRUSH));
  41. lb.lbColor =RGB(7, 47, 136);
  42. lb.lbStyle =BS_NULL;
  43. m_Brush.CreateBrushIndirect(&lb);
  44. CBrush* pOldBrush =(CBrush*)dc.SelectObject(&m_Brush);
  45. CPen m_Pen;
  46. m_Pen.CreatePen(PS_SOLID, 3, RGB(7,47, 136));
  47. CPen* pOldPen =(CPen*)dc.SelectObject(&m_Pen);
  48. memset(&rect, 0, sizeof(RECT));
  49. this->GetClientRect(&rect);
  50. rect.left +=2;
  51. rect.top +=1;
  52. rect.right -=1;
  53. rect.bottom -=1;
  54. dc.Rectangle(&rect);
  55. dc.SelectObject(pOldBrush);
  56. dc.SelectObject(pOldPen);
  57. m_Pen.DeleteObject();
  58. m_Brush.DeleteObject();
  59. HFONT hFont =NULL;
  60. if(IsWin9x())
  61. {
  62. hFont=::CreateFont(15,0,0,0,FW_BOLD,0,0,0,0,0,0,0,0,"");
  63. }
  64. else
  65. {
  66. hFont=::CreateFont(14,0,0,0,FW_BOLD,0,0,0,0,0,0,0,0,"");
  67. }
  68. HFONT hOldFont =(HFONT)::SelectObject(dc.GetSafeHdc(), hFont);
  69. dc.SetBkMode(TRANSPARENT);
  70. dc.SetTextColor(RGB(79, 80, 80));
  71. char buffer[256];
  72. memset(buffer, 0, sizeof(char) * 256);
  73. wsprintf(buffer, "IP     : 202.183.173.89n位置:北京朝阳区Game High网吧");
  74. memset(&rect, 0, sizeof(RECT));
  75. this->GetClientRect(&rect);
  76. rect.top +=10;
  77. rect.left +=10;
  78. dc.DrawText(buffer, strlen(buffer), &rect, DT_VCENTER | DT_WORDBREAK);
  79. ::SelectObject(dc.GetSafeHdc(), hOldFont);
  80. ::DeleteObject(hFont);
  81. hFont =NULL;
  82. }
  83. BOOL CShowIpWnd::OnEraseBkgnd(CDC* pDC) 
  84. {
  85. return TRUE;
  86. }