forked from lianera/archives
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPanel.cpp
96 lines (73 loc) · 1.77 KB
/
Panel.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Panel.cpp: implementation of the CPanel class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Panel.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
extern HWND hWnd;
CPanel::CPanel()
{
BuildPanel();
}
CPanel::~CPanel()
{
}
void CPanel::DrawPanel(HDC hDC)
{
HPEN oldpen=(HPEN)SelectObject(hDC,groundpen);
HBRUSH oldbrush=(HBRUSH)SelectObject(hDC,groundbrush);
Rectangle(hDC,m_groundRect.left,m_groundRect.top,m_groundRect.right,m_groundRect.bottom);
SelectObject(hDC,infopen);
SelectObject(hDC,infobrush);
Rectangle(hDC,m_infoRect.left,m_infoRect.top,m_infoRect.right,m_infoRect.bottom);
SelectObject(hDC,oldpen);
SelectObject(hDC,oldbrush);
}
void CPanel::BuildPanel()
{
m_groundRect.left =GROUNDLEFT;
m_groundRect.right =GROUNDRIGHT;
m_groundRect.top =GROUNDTOP;
m_groundRect.bottom =GROUNDBUTTOM;
m_infoRect.left =INFOLEFT;
m_infoRect.right =INFORIGHT;
m_infoRect.top =INFOTOP;
m_infoRect.bottom =INFOBUTTOM;
m_gx=GRIDXNUMBER;
m_gy=GRIDYNUMBER;
m_gcx=GetWidth()/GRIDXNUMBER;
m_gcy=GetWidth()/GRIDYNUMBER;
}
int CPanel::GetGcx()
{
return m_gcx;
}
int CPanel::GetGcy()
{
return m_gcy;
}
RECT CPanel::GetGround()
{
return m_groundRect;
}
RECT CPanel::GetInfoRect()
{
return m_infoRect;
}
int CPanel::GetWidth()
{
return m_groundRect.right-m_groundRect.left;
}
int CPanel::GetHeight()
{
return m_groundRect.bottom-m_groundRect.top;
}
void CPanel::InitDraw(HDC hDC)
{
groundpen=CreatePen(PS_SOLID,GROUNDWIDE,GROUNDBORDERCOLOR);
infopen=CreatePen(PS_SOLID,INFOWIDE,INFOBORDERCOLOR);
groundbrush=CreateSolidBrush(GROUNDFACECOLOR);
infobrush=CreateSolidBrush(INFOFACECOLOR);
}