提交 | 用户 | age
|
b978bf
|
1 |
// MyDlgBarFuncKey.cpp: 实现文件
|
Q |
2 |
//
|
|
3 |
|
|
4 |
#include "pch.h"
|
|
5 |
#include "MTerm2.h"
|
|
6 |
#include "MyDlgBarFuncKey.h"
|
|
7 |
#include "afxdialogex.h"
|
|
8 |
|
|
9 |
|
|
10 |
// CMyDlgBarFuncKey 对话框
|
|
11 |
CMyDlgBarFuncKey::structButton myButtons[3][12] =
|
|
12 |
{
|
|
13 |
{33101,_T("11"), 33102,_T("12") ,33103,_T("13"), 33104,_T("14") ,33105,_T("15") ,33106,_T("16") ,33107,_T("17") ,33108,_T("18") ,33109,_T("19") ,33110,_T("110") ,33111,_T("111"), 33112,_T("112") },
|
|
14 |
{33201,_T("21"), 33202,_T("22") ,33203,_T("23"), 33204,_T("24") ,33205,_T("25") ,33206,_T("26") ,33207,_T("27") ,33208,_T("28") ,33209,_T("29") ,33210,_T("210") ,33211,_T("211"), 33212,_T("212") },
|
|
15 |
{33301,_T("31"), 33302,_T("32") ,33303,_T("33"), 33304,_T("34") ,33305,_T("35") ,33306,_T("36") ,33307,_T("37") ,33308,_T("38") ,33309,_T("39") ,33310,_T("310") ,33311,_T("311"), 33312,_T("312") },
|
|
16 |
};
|
|
17 |
static int myButtonCount = sizeof(myButtons) / sizeof(CMyDlgBarFuncKey::structButton);
|
|
18 |
|
|
19 |
IMPLEMENT_DYNAMIC(CMyDlgBarFuncKey, CDialogBar)
|
|
20 |
|
|
21 |
CMyDlgBarFuncKey::CMyDlgBarFuncKey(CWnd* pParent /*=nullptr*/)
|
|
22 |
{
|
|
23 |
|
|
24 |
}
|
|
25 |
|
|
26 |
CMyDlgBarFuncKey::~CMyDlgBarFuncKey()
|
|
27 |
{
|
|
28 |
}
|
|
29 |
|
|
30 |
void CMyDlgBarFuncKey::DoDataExchange(CDataExchange* pDX)
|
|
31 |
{
|
|
32 |
|
|
33 |
}
|
|
34 |
|
|
35 |
|
|
36 |
BEGIN_MESSAGE_MAP(CMyDlgBarFuncKey, CDialogBar)
|
|
37 |
ON_MESSAGE(WM_INITDIALOG, CMyDlgBarFuncKey::OnInitDialog)
|
|
38 |
ON_BN_CLICKED(IDC_BUTTON1, &CMyDlgBarFuncKey::OnBnClickedButton1)
|
|
39 |
END_MESSAGE_MAP()
|
|
40 |
|
|
41 |
|
|
42 |
// CMyDlgBarFuncKey 消息处理程序
|
|
43 |
|
|
44 |
|
|
45 |
LRESULT CMyDlgBarFuncKey::OnInitDialog(WPARAM wParam, LPARAM lParam)
|
|
46 |
{
|
|
47 |
// TODO: 在此处添加实现代码.
|
|
48 |
//CDialogBar::OnInitDialog();
|
|
49 |
// TODO: Add extra initialization here
|
|
50 |
CString(s1);
|
|
51 |
|
|
52 |
s1.Format(_T(" MyDlgBarFuncKey OnInitDialog "));
|
|
53 |
SysLog(s1);
|
|
54 |
|
|
55 |
LRESULT bRet = HandleInitDialog(wParam, lParam);
|
|
56 |
if (!UpdateData(FALSE))
|
|
57 |
{
|
|
58 |
TRACE("InitDialogBar Failed!");
|
|
59 |
}
|
|
60 |
CRect rect0;
|
|
61 |
GetClientRect(&rect0);
|
|
62 |
int nWidth = rect0.Width();
|
|
63 |
int nHeight = rect0.Height();
|
|
64 |
int nLeftMargin = 48;
|
|
65 |
int nSpace = nWidth - nLeftMargin;
|
|
66 |
int x1, y1, x2, y2;
|
|
67 |
CRect rect1(0, 0, 100, 24);
|
|
68 |
for (int i = 0; i < m_Lines; i++) {
|
|
69 |
for (int j = 0; j < 12; j++) {
|
|
70 |
x1 = nLeftMargin + j * nSpace / 12;
|
|
71 |
y1 = i * nHeight / 3;
|
|
72 |
x2 = x1 + nSpace / 12;
|
|
73 |
y2 = y1 + nHeight / 3;
|
|
74 |
rect1.SetRect(x1, y1, x2, y2);
|
|
75 |
m_buttons[i][j].Create(myButtons[i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON, rect1, this, myButtons[i][j].nID);
|
|
76 |
}
|
|
77 |
}
|
|
78 |
return bRet; // return TRUE unless you set the focus to a control
|
|
79 |
// EXCEPTION: OCX Property Pages should return FALSE
|
|
80 |
return false;
|
|
81 |
}
|
|
82 |
|
|
83 |
|
|
84 |
BOOL CMyDlgBarFuncKey::Create(CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID)
|
|
85 |
{
|
|
86 |
// TODO: 在此添加专用代码和/或调用基类
|
|
87 |
BOOL bRes = CDialogBar::Create(pParentWnd, nIDTemplate, nStyle, nID);
|
|
88 |
// OnInitDialog(0,0);
|
|
89 |
return bRes;
|
|
90 |
//
|
|
91 |
// return CDialogBar::Create(pParentWnd, nIDTemplate, nStyle, nID);
|
|
92 |
}
|
|
93 |
|
|
94 |
|
|
95 |
void CMyDlgBarFuncKey::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHandler)
|
|
96 |
{
|
|
97 |
// TODO: 在此添加专用代码和/或调用基类
|
|
98 |
CDialogBar::OnUpdateCmdUI(pTarget, FALSE);
|
|
99 |
}
|
|
100 |
|
|
101 |
|
|
102 |
void CMyDlgBarFuncKey::OnBnClickedButton1()
|
|
103 |
{
|
|
104 |
// TODO: 在此添加控件通知处理程序代码
|
|
105 |
CString s1;
|
|
106 |
s1.Format(_T("Button1 Clicked"));
|
|
107 |
SysLog(s1);
|
|
108 |
}
|