-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataDialog.cpp
More file actions
88 lines (67 loc) · 1.72 KB
/
DataDialog.cpp
File metadata and controls
88 lines (67 loc) · 1.72 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
// DataDialog.cpp : implementation file
//
#include "stdafx.h"
#include "WinEVE.h"
#include "DataDialog.h"
#include "FontCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDataDialog dialog
CDataDialog::CDataDialog(CWnd* pParent /*=NULL*/)
: CDialog(CDataDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CDataDialog)
m_contents = _T("");
m_addr = _T("");
//}}AFX_DATA_INIT
}
void CDataDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDataDialog)
DDX_Text(pDX, IDC_CONTENTS, m_contents);
DDV_MaxChars(pDX, m_contents, 16);
DDX_Text(pDX, IDC_LOCATION, m_addr);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDataDialog, CDialog)
//{{AFX_MSG_MAP(CDataDialog)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDataDialog message handlers
void CDataDialog::OnOK()
{
int i;
char txt[20];
UpdateData(TRUE);
strcpy_s(txt,20,m_contents);
i=0;
while (txt[i]!=0 && txt[i]!=' ')
{
if (!isxdigit(txt[i])) return;
i++;
}
CDialog::OnOK();
}
void CDataDialog::OnPaint()
{
CPaintDC dc(this); // device context for painting
CFont m_Font;
m_Font.CreateFont(15,0,0,0,400,FALSE,FALSE,
0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Courier New");
// m_Font.CreatePointFont(100,"Courier");
CFontCtrl<CEdit> * pEdit;
pEdit = (CFontCtrl<CEdit> *)GetDlgItem(IDC_CONTENTS);
pEdit->SetFont(&m_Font,FALSE);
m_Font.DeleteObject();
// GetDlgItem(IDC_CONTENTS)->SetFocus();
// Do not call CDialog::OnPaint() for painting messages
}