-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSizer.cpp
103 lines (86 loc) · 2.51 KB
/
Sizer.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
97
98
99
100
101
102
103
// Sizer.cpp : implementation file
//
#include "stdafx.h"
#include "SynapticsPen.h"
#include "Sizer.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSizer dialog
CSizer::CSizer(CWnd* pParent /*=NULL*/)
: CDialog(CSizer::IDD, pParent)
{
//{{AFX_DATA_INIT(CSizer)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
rect.left = 100;
rect.top = 100;
rect.right = 400;
rect.bottom = 400;
}
void CSizer::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSizer)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSizer, CDialog)
//{{AFX_MSG_MAP(CSizer)
ON_BN_CLICKED(IDC_BTNFINISHED, OnBtnfinished)
ON_WM_LBUTTONDOWN()
ON_WM_CANCELMODE()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSizer message handlers
void CSizer::OnBtnfinished()
{
GetWindowRect(&rect);
this->EndDialog(1);
}
void CSizer::OnLButtonDown(UINT nFlags, CPoint point)
{
ReleaseCapture();
SendMessage(WM_SYSCOMMAND, SC_MOVE + HTCAPTION,0);
//CDialog::OnLButtonDown(nFlags, point);
}
BOOL CSizer::OnInitDialog()
{
BOOL rtn = CDialog::OnInitDialog();
HICON m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
CString m_title;
m_title.LoadString(IDS_SIZER_TITLE);
this->SetIcon(m_hIcon,TRUE);
this->SetWindowText(m_title);
SetWindowPos(&wndTopMost,rect.left,rect.top,rect.Width(),rect.Height(),0);
//transparent
SetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE,GetWindowLong(this-> GetSafeHwnd(),GWL_EXSTYLE)^0x80000);
//MessageBox("DoDataExchange");
HMODULE hUser32 = GetModuleHandle("user32.dll");
if (hUser32) {
typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD);
MYFUNC SetLayeredWindowAttributes = NULL;
SetLayeredWindowAttributes = (MYFUNC)GetProcAddress(hUser32, "SetLayeredWindowAttributes");
SetLayeredWindowAttributes(GetSafeHwnd(), 0, 150, LWA_ALPHA);
FreeLibrary(hUser32);
}
return rtn;
}
void CSizer::OnPaint()
{
CPaintDC dc(this); // device context for painting
CPen p(PS_SOLID,3,RGB(0,0,0));
dc.SelectObject(p);
dc.MoveTo(0,0);
CRect r;
GetWindowRect(r);
dc.LineTo(-pRegion.Width() * r.Height() / pRegion.Height(),r.Height());
dc.LineTo(r.Width(),-pRegion.Height() * r.Width() / pRegion.Width());
// TODO: Add your message handler code here
// Do not call CDialog::OnPaint() for painting messages
}