-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRegDialog.cpp
More file actions
85 lines (67 loc) · 1.67 KB
/
RegDialog.cpp
File metadata and controls
85 lines (67 loc) · 1.67 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
// RegDialog.cpp : implementation file
//
#include "stdafx.h"
#include "WinEVE.h"
#include "RegDialog.h"
#include "FontCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRegDialog dialog
CRegDialog::CRegDialog(CWnd* pParent /*=NULL*/)
: CDialog(CRegDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CRegDialog)
m_reg = _T("");
m_name = _T("");
//}}AFX_DATA_INIT
}
void CRegDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CRegDialog)
DDX_Text(pDX, IDC_REG, m_reg);
DDV_MaxChars(pDX, m_reg, 16);
DDX_Text(pDX, IDC_REGNAME, m_name);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CRegDialog, CDialog)
//{{AFX_MSG_MAP(CRegDialog)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRegDialog message handlers
void CRegDialog::OnOK()
{
int i;
char txt[20];
UpdateData(TRUE);
strcpy_s(txt,20,m_reg);
i=0;
while (txt[i]!=0 && txt[i]!=' ')
{
if (!isxdigit(txt[i])) return;
i++;
}
CDialog::OnOK();
}
void CRegDialog::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_REG);
pEdit->SetFont(&m_Font,FALSE);
m_Font.DeleteObject();
// GetDlgItem(IDC_REG)->SetFocus();
// Do not call CDialog::OnPaint() for painting messages
}