-
Notifications
You must be signed in to change notification settings - Fork 59
/
MessageDlg.cpp
75 lines (57 loc) · 1.78 KB
/
MessageDlg.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
// MessageDlg.cpp : implementation file
//
#include "StdAfx.h"
#include "XMLTools.h"
#include "MessageDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMessageDlg dialog
CMessageDlg::CMessageDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMessageDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMessageDlg)
m_sMessage = _T("");
//}}AFX_DATA_INIT
}
void CMessageDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMessageDlg)
DDX_Text(pDX, IDC_EDIT_MULTILINEMSG, m_sMessage);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMessageDlg, CDialog)
//{{AFX_MSG_MAP(CMessageDlg)
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMessageDlg message handlers
BOOL CMessageDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CRect myRect;
GetClientRect(&myRect);
ClientToScreen(myRect);
MoveWindow(myRect.left+100, myRect.top+100, myRect.Width(), myRect.Height());
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CMessageDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
CWnd *edit_wnd = GetDlgItem(IDC_EDIT_MULTILINEMSG);
CWnd *btn_wnd = GetDlgItem(IDOK);
if (btn_wnd && edit_wnd) {
const int border = 8;
const int wndspace = 6;
const int btnwidth = 75;
const int btnheight = 24;
edit_wnd->MoveWindow(border,border,cx-2*border,cy-2*border-btnheight-wndspace);
btn_wnd->MoveWindow(cx-border-btnwidth, cy-border-btnheight, btnwidth, btnheight);
}
}