-
Notifications
You must be signed in to change notification settings - Fork 2
/
ControlChooese.cpp
337 lines (264 loc) · 7.79 KB
/
ControlChooese.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
// ControlChooese.cpp : 实现文件
//
#include "stdafx.h"
#include "BCGPChartExample.h"
#include "ControlChooese.h"
#include "afxdialogex.h"
#include "MainFrm.h"
#include "QualityControlView.h"
// CControlChooese 对话框
IMPLEMENT_DYNAMIC(CControlChooese, CDialogEx)
CControlChooese::CControlChooese(CWnd* pParent /*=NULL*/): CDialogEx(CControlChooese::IDD, pParent) , m_ControltypeRadio(0)
{
VERIFY(textfont.CreateFont(
15, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_NORMAL, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
GB2312_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
L"宋体")); // lpszFacename
Controltype = m_ControltypeRadio;
}
CControlChooese::~CControlChooese()
{
}
void CControlChooese::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_FILEBUTTON1, m_File1);
DDX_Control(pDX, IDC_FILEBUTTON2, m_file2);
DDX_Control(pDX, IDC_FILEBUTTON3, m_file3);
DDX_Control(pDX, IDC_FILEBUTTON4, m_file4);
DDX_Control(pDX, IDC_FILEBUTTON5, m_file5);
DDX_Control(pDX, IDC_FILEBUTTON6, m_file6);
DDX_Control(pDX, IDC_FILEBUTTON7, m_file7);
DDX_Control(pDX, IDC_FILEBUTTON8, m_file8);
DDX_Control(pDX, IDC_FILEBUTTON9, m_file9);
DDX_Radio(pDX, IDC_LJCONTROLRADIO, m_ControltypeRadio);
//DDX_Radio(pDX, IDC_XCONTROLRADIO, m_ControltypeRadio);
//DDX_Radio(pDX, IDC_XRCONTROLRADIO, m_ControltypeRadio);
}
BEGIN_MESSAGE_MAP(CControlChooese, CDialogEx)
ON_WM_CLOSE()
ON_WM_CTLCOLOR()
ON_WM_CREATE()
ON_WM_PAINT()
ON_BN_CLICKED(IDC_LJCONTROLRADIO, &CControlChooese::OnLjcontrolradio)
ON_BN_CLICKED(IDC_FILEBUTTON1, &CControlChooese::OnFilebutton1)
ON_BN_CLICKED(IDC_FILEBUTTON2, &CControlChooese::OnFilebutton2)
ON_BN_CLICKED(IDC_FILEBUTTON3, &CControlChooese::OnFilebutton3)
ON_BN_CLICKED(IDC_FILEBUTTON4, &CControlChooese::OnFilebutton4)
ON_BN_CLICKED(IDC_FILEBUTTON5, &CControlChooese::OnFilebutton5)
ON_BN_CLICKED(IDC_FILEBUTTON6, &CControlChooese::OnFilebutton6)
ON_BN_CLICKED(IDC_FILEBUTTON7, &CControlChooese::OnFilebutton7)
ON_BN_CLICKED(IDC_FILEBUTTON8, &CControlChooese::OnFilebutton8)
ON_BN_CLICKED(IDC_FILEBUTTON9, &CControlChooese::OnFilebutton9)
ON_BN_CLICKED(IDC_XCONTROLRADIO, &CControlChooese::OnBnClickedXcontrolradio)
ON_BN_CLICKED(IDC_XRCONTROLRADIO, &CControlChooese::OnBnClickedXrcontrolradio)
END_MESSAGE_MAP()
// CControlChooese 消息处理程序
void CControlChooese::OnClose()
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
//MessageBox(L"close here!");
//CMainFrame* mainFrame;
//CView* pNewView = mainFrame->GetView(2);
//CView* pActiveView =GetActiveView();
CDialogEx::OnClose();
//CurView = 3;
//pActiveView->ShowWindow(SW_HIDE);
//pNewView->ShowWindow(SW_SHOW);
//SetActive(pNewView);
//HWND hwnd = this->m_hWnd;
//::PostMessage(hwnd,WM_DESTROY, 0, 0);
//CQualityControlView *parentWnd = (CQualityControlView*)this->GetParent();
////::PostMessage(parentWnd, WM_DESTROY, 0, 0);
//HWND prthwnd = parentWnd->GetSafeHwnd();
////parentWnd->DestroyWindow();
//::PostMessage(prthwnd, WM_DESTROY, 0, 0);
}
HBRUSH CControlChooese::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: 在此更改 DC 的任何特性
switch (pWnd->GetDlgCtrlID())
{
case IDC_LJCONTROLRADIO:
case IDC_XCONTROLRADIO:
case IDC_XRCONTROLRADIO:
case IDC_STATIC1:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0, 0, 0));
return (HBRUSH)GetStockObject(HOLLOW_BRUSH);
default:
break;
}
// TODO: 如果默认的不是所需画笔,则返回另一个画笔
return hbr;
}
int CControlChooese::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialogEx::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: 在此添加您专用的创建代码
return 0;
}
void CControlChooese::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: 在此处添加消息处理程序代码
// 不为绘图消息调用 CDialogEx::OnPaint()
CRect rect;
GetClientRect(rect);
dc.FillSolidRect(rect, RGB(255, 255, 255));
dc.FillPath();
}
BOOL CControlChooese::OnInitDialog()
{
CDialogEx::OnInitDialog();
// TODO: 在此添加额外的初始化
GetDlgItem(IDC_LJCONTROLRADIO)->SetFont(&textfont);
GetDlgItem(IDC_XCONTROLRADIO)->SetFont(&textfont);
GetDlgItem(IDC_XRCONTROLRADIO)->SetFont(&textfont);
GetDlgItem(IDC_STATIC1)->SetFont(&textfont);
Initbutton();
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}
void CControlChooese::Initbutton()
{
m_File1.SetImage(IDB_CONTROLTYPE);
m_File1.SetWindowText(L"文件1");
m_File1.m_bRighImage = FALSE;
m_File1.m_bTopImage = TRUE;
m_File1.SizeToContent();
m_File1.Invalidate();
m_file2.SetImage(IDB_CONTROLTYPE);
m_file2.SetWindowText(L"文件2");
m_file2.m_bRighImage = FALSE;
m_file2.m_bTopImage = TRUE;
m_file2.SizeToContent();
m_file2.Invalidate();
m_file3.SetImage(IDB_CONTROLTYPE);
m_file3.SetWindowText(L"文件3");
m_file3.m_bRighImage = FALSE;
m_file3.m_bTopImage = TRUE;
m_file3.SizeToContent();
m_file3.Invalidate();
m_file4.SetImage(IDB_CONTROLTYPE);
m_file4.SetWindowText(L"文件4");
m_file4.m_bRighImage = FALSE;
m_file4.m_bTopImage = TRUE;
m_file4.SizeToContent();
m_file4.Invalidate();
m_file5.SetImage(IDB_CONTROLTYPE);
m_file5.SetWindowText(L"文件5");
m_file5.m_bRighImage = FALSE;
m_file5.m_bTopImage = TRUE;
m_file5.SizeToContent();
m_file5.Invalidate();
m_file6.SetImage(IDB_CONTROLTYPE);
m_file6.SetWindowText(L"文件6");
m_file6.m_bRighImage = FALSE;
m_file6.m_bTopImage = TRUE;
m_file6.SizeToContent();
m_file6.Invalidate();
m_file7.SetImage(IDB_CONTROLTYPE);
m_file7.SetWindowText(L"文件7");
m_file7.m_bRighImage = FALSE;
m_file7.m_bTopImage = TRUE;
m_file7.SizeToContent();
m_file7.Invalidate();
m_file8.SetImage(IDB_CONTROLTYPE);
m_file8.SetWindowText(L"文件8");
m_file8.m_bRighImage = FALSE;
m_file8.m_bTopImage = TRUE;
m_file8.SizeToContent();
m_file8.Invalidate();
m_file9.SetImage(IDB_CONTROLTYPE);
m_file9.SetWindowText(L"文件9");
m_file9.m_bRighImage = FALSE;
m_file9.m_bTopImage = TRUE;
m_file9.SizeToContent();
m_file9.Invalidate();
}
void CControlChooese::OnLjcontrolradio()
{
// TODO: 在此添加控件通知处理程序代码
UpdateData(true);
Controltype = m_ControltypeRadio;
}
void CControlChooese::OnBnClickedXcontrolradio()
{
// TODO: 在此添加控件通知处理程序代码
UpdateData(true);
Controltype = 1;
}
void CControlChooese::OnBnClickedXrcontrolradio()
{
// TODO: 在此添加控件通知处理程序代码
UpdateData(true);
Controltype = 2;
}
void CControlChooese::OnFilebutton1()
{
// TODO: 在此添加控件通知处理程序代码
Controlfile = 0;
CDialog::OnOK();
}
void CControlChooese::OnFilebutton2()
{
// TODO: 在此添加控件通知处理程序代码
Controlfile = 1;
CDialog::OnOK();
}
void CControlChooese::OnFilebutton3()
{
// TODO: 在此添加控件通知处理程序代码
Controlfile = 2;
CDialog::OnOK();
}
void CControlChooese::OnFilebutton4()
{
// TODO: 在此添加控件通知处理程序代码
Controlfile = 3;
CDialog::OnOK();
}
void CControlChooese::OnFilebutton5()
{
// TODO: 在此添加控件通知处理程序代码
Controlfile = 4;
CDialog::OnOK();
}
void CControlChooese::OnFilebutton6()
{
// TODO: 在此添加控件通知处理程序代码
Controlfile = 5;
CDialog::OnOK();
}
void CControlChooese::OnFilebutton7()
{
// TODO: 在此添加控件通知处理程序代码
Controlfile = 6;
CDialogEx::OnOK();
}
void CControlChooese::OnFilebutton8()
{
// TODO: 在此添加控件通知处理程序代码
Controlfile = 7;
CDialog::OnOK();
}
void CControlChooese::OnFilebutton9()
{
// TODO: 在此添加控件通知处理程序代码
Controlfile = 8;
CDialog::OnOK();
}