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
97
98
99
100
101
102
103
104
105
106
107
108
109
|
#include "GlobalFunc.h"
#include "T2ArrowWnd.h"
#include "T2TowerDoc.h"
#include "T2TowerMainView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
static POINT rgnPoints[7] = {
{20,35},
{0, 15},
{10,15},
{10,0},
{30,0},
{30,15},
{40,15}
};
#line 33
IMPLEMENT_DYNCREATE(T2ArrowWnd, CFrameWnd);
T2ArrowWnd::T2ArrowWnd() {
}
/*virtual*/ T2ArrowWnd::~T2ArrowWnd() {
}
void T2ArrowWnd::Show(int inX, int inY, T2TowerDoc* inDoc) {
mWndClass = AfxRegisterWndClass(CS_NOCLOSE, NULL, (HBRUSH) GetStockObject(WHITE_BRUSH));
CRect rect(0, 0, 50, 50);
Create(mWndClass, "ArrowWnd", WS_CHILD, rect, inDoc->GetMainView(), NULL, WS_EX_TOPMOST);
mRgn.CreatePolygonRgn(rgnPoints, 7, ALTERNATE);
CRect clientRect;
GetClientRect(clientRect);
CPoint center;
center.x = ((rect.right - rect.left) - (clientRect.right - clientRect.left)) / 2;
center.y = ((rect.bottom - rect.top) - (clientRect.bottom - clientRect.top)) / 2;
CRgn region;
region.CreateRectRgn(0, 0, 1, 1);
region.CopyRgn(&mRgn);
region.OffsetRgn(center.x, center.y);
SetWindowRgn(region, true);
region.Detach();
SetWindowPos(NULL, inX - 20, inY - 45, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
GetCurrentT2TowerDoc()->towerDoc_vf290(true);
GetCurrentT2TowerDoc()->towerDoc_vf1A0(true);
mCounter = 0;
SetTimer(1, 50, NULL);
}
BEGIN_MESSAGE_MAP(T2ArrowWnd, CFrameWnd)
ON_WM_ERASEBKGND()
ON_WM_TIMER()
ON_WM_DESTROY()
END_MESSAGE_MAP()
afx_msg BOOL T2ArrowWnd::OnEraseBkgnd(CDC* pDC) {
int save = pDC->SaveDC();
{
CRect rect;
GetClientRect(rect);
COLORREF bkColor;
if (mCounter & 1)
bkColor = RGB(255, 0, 0);
else
bkColor = RGB(255, 255, 0);
pDC->FillSolidRect(rect, bkColor);
CBrush brush;
brush.CreateStockObject(BLACK_BRUSH);
pDC->FrameRgn(&mRgn, &brush, 1, 1);
}
pDC->RestoreDC(save);
return true;
}
afx_msg void T2ArrowWnd::OnTimer(UINT nIDEvent) {
if (nIDEvent == 1) {
if (mCounter == 0)
ShowWindow(SW_SHOWNA);
mCounter++;
if (mCounter > 30) {
ShowWindow(SW_HIDE);
DestroyWindow();
} else {
InvalidateRect(NULL);
}
}
}
afx_msg void T2ArrowWnd::OnDestroy() {
CFrameWnd::OnDestroy();
DeleteObject(mRgn);
GetCurrentT2TowerDoc()->towerDoc_vf294();
GetCurrentT2TowerDoc()->towerDoc_vf1A0(false);
KillTimer(1);
}
|