-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathResizeControl.cpp
More file actions
94 lines (80 loc) · 1.85 KB
/
Copy pathResizeControl.cpp
File metadata and controls
94 lines (80 loc) · 1.85 KB
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
// ResizeControl.cpp: implementation of the CResizeControl class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ResizeControl.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CResizeControl::CResizeControl()
{
// m_pWnd=pWnd;
}
CResizeControl::~CResizeControl()
{
}
void CResizeControl::SetOwner(CWnd *pWnd)
{
m_pWnd=pWnd;
pWnd->GetClientRect(&m_rtParent);
}
void CResizeControl::OnSize(int cx,int cy)
{
int offsetx,offsety;
CRect rt;
offsetx=cx-m_rtParent.right-m_rtParent.left;
offsety=cy-m_rtParent.bottom-m_rtParent.top;
for(int i=0;i<m_arrResize.GetSize();i++)
{
rt=m_arrResize.GetAt(i).rt;
switch(m_arrResize.GetAt(i).type1)
{
case PK_TOP_LEFT:
break;
case PK_TOP_RIGHT:
rt.left+=offsetx;
break;
case PK_BOTTOM_LEFT:
rt.top+=offsety;
break;
case PK_BOTTOM_RIGHT:
rt.top+=offsety;
rt.left+=offsetx;
break;
}
switch(m_arrResize.GetAt(i).type2)
{
case PK_TOP_LEFT:
break;
case PK_TOP_RIGHT:
rt.right+=offsetx;
break;
case PK_BOTTOM_LEFT:
rt.bottom+=offsety;
break;
case PK_BOTTOM_RIGHT:
rt.bottom+=offsety;
rt.right+=offsetx;
break;
}
if(m_pWnd->GetDlgItem(m_arrResize.GetAt(i).ID)->m_hWnd)
m_pWnd->GetDlgItem(m_arrResize.GetAt(i).ID)->MoveWindow(rt);
}
}
void CResizeControl::SetResize(UINT ID, int type1, int type2)
{
tagResize iCon;
CRect rt;
iCon.ID=ID;
m_pWnd->GetDlgItem(ID)->GetWindowRect(&rt);
m_pWnd->ScreenToClient(rt);
iCon.rt=rt;
iCon.type1=type1;
iCon.type2=type2;
m_arrResize.Add(iCon);
}