提交 | 用户 | age
|
0ed438
|
1 |
|
Q |
2 |
// ChildFrm.cpp: CChildFrame 类的实现
|
|
3 |
//
|
|
4 |
|
|
5 |
#include "pch.h"
|
|
6 |
#include "framework.h"
|
|
7 |
#include "MTerm2.h"
|
|
8 |
|
|
9 |
#include "ChildFrm.h"
|
|
10 |
|
|
11 |
#ifdef _DEBUG
|
|
12 |
#define new DEBUG_NEW
|
|
13 |
#endif
|
|
14 |
|
|
15 |
// CChildFrame
|
|
16 |
|
|
17 |
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWndEx)
|
|
18 |
|
|
19 |
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWndEx)
|
|
20 |
ON_WM_CREATE()
|
|
21 |
END_MESSAGE_MAP()
|
|
22 |
|
|
23 |
static UINT indicators[] =
|
|
24 |
{
|
|
25 |
ID_INDICATOR_MACHINE_TYPE, // 状态行指示器
|
|
26 |
ID_INDICATOR_PROGRAM_POS,
|
|
27 |
ID_INDICATOR_CONNECTIVITY,
|
|
28 |
ID_INDICATOR_RUN_STATUS,
|
|
29 |
ID_INDICATOR_MONITOR_STATUS,
|
|
30 |
ID_INDICATOR_TARGET_ADDRESS,
|
|
31 |
ID_INDICATOR_INFO_DISPLAY,
|
|
32 |
};
|
|
33 |
|
|
34 |
// CChildFrame 构造/析构
|
|
35 |
|
|
36 |
CChildFrame::CChildFrame() noexcept
|
|
37 |
{
|
|
38 |
// TODO: 在此添加成员初始化代码
|
|
39 |
}
|
|
40 |
|
|
41 |
CChildFrame::~CChildFrame()
|
|
42 |
{
|
|
43 |
}
|
|
44 |
|
|
45 |
|
|
46 |
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
|
|
47 |
{
|
|
48 |
// TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或样式
|
|
49 |
if( !CMDIChildWndEx::PreCreateWindow(cs) )
|
|
50 |
return FALSE;
|
|
51 |
//修改窗口的类型为最大化样式
|
|
52 |
// cs.style = cs.style | WS_MAXIMIZE | WS_VISIBLE;
|
|
53 |
return TRUE;
|
|
54 |
}
|
|
55 |
|
|
56 |
// CChildFrame 诊断
|
|
57 |
|
|
58 |
#ifdef _DEBUG
|
|
59 |
void CChildFrame::AssertValid() const
|
|
60 |
{
|
|
61 |
CMDIChildWndEx::AssertValid();
|
|
62 |
}
|
|
63 |
|
|
64 |
void CChildFrame::Dump(CDumpContext& dc) const
|
|
65 |
{
|
|
66 |
CMDIChildWndEx::Dump(dc);
|
|
67 |
}
|
|
68 |
#endif //_DEBUG
|
|
69 |
|
|
70 |
// CChildFrame 消息处理程序
|
|
71 |
|
|
72 |
|
|
73 |
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
|
74 |
{
|
|
75 |
if (CMDIChildWndEx::OnCreate(lpCreateStruct) == -1)
|
|
76 |
return -1;
|
|
77 |
|
|
78 |
// TODO: 在此添加您专用的创建代码
|
|
79 |
this->ModifyStyle(WS_SIZEBOX,0);
|
|
80 |
///*
|
|
81 |
if (!m_wndStatusBar.Create(this , (WS_CHILD | WS_VISIBLE | CBRS_TOP), IDW_CHILD_STATUS_BAR))
|
|
82 |
{
|
|
83 |
TRACE0("未能创建状态栏\n");
|
|
84 |
return -1; // 未能创建
|
|
85 |
}
|
|
86 |
m_wndStatusBar.SetIndicators(indicators, sizeof(indicators) / sizeof(UINT));
|
|
87 |
|
|
88 |
//*/
|
|
89 |
this->ModifyStyle(0,WS_SIZEBOX);
|
|
90 |
|
|
91 |
/*
|
|
92 |
if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators) / sizeof(UINT)))
|
|
93 |
{
|
|
94 |
TRACE0("未能创建状态栏\n");
|
|
95 |
return -1; // 未能创建
|
|
96 |
}
|
|
97 |
*/
|
|
98 |
m_wndStatusBar.SetPaneInfo(0, 0, 0, 100);
|
|
99 |
m_wndStatusBar.SetPaneInfo(1, 0, 0, 100);
|
|
100 |
m_wndStatusBar.SetPaneInfo(2, 0, 0, 100);
|
|
101 |
//
|
|
102 |
// m_wndStatusBar.SetPaneText(0, _T("机型参数"), false);
|
|
103 |
// m_wndStatusBar.SetPaneText(1, _T("程序位置/总数"), false);
|
|
104 |
m_wndStatusBar.SetPaneInfo(6, 0, 0, 9999);
|
|
105 |
|
|
106 |
// m_wndStatusBar.MoveWindow(0, 0, 1800, 28);
|
|
107 |
// m_wndStatusBar.EnableDocking(CBRS_ALIGN_TOP);
|
|
108 |
// EnableDocking(CBRS_ALIGN_ANY);
|
|
109 |
// AdjustClientArea();
|
|
110 |
// DockPane(&m_wndStatusBar);
|
|
111 |
|
|
112 |
/*
|
|
113 |
if (!m_wndToolBar_InfoShow.CreateEx(this, TBSTYLE_FLAT,
|
|
114 |
WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,
|
|
115 |
CRect(1, 1, 1, 1), IDR_TOOLBAR_INFO_SHOW) ||
|
|
116 |
!m_wndToolBar_InfoShow.LoadToolBar(IDR_TOOLBAR_INFO_SHOW))
|
|
117 |
{
|
|
118 |
TRACE0("未能创建数字工具栏\n");
|
|
119 |
return -1; // 未能创建
|
|
120 |
}
|
|
121 |
CRect rect1;
|
|
122 |
int index = m_wndToolBar_InfoShow.CommandToIndex(ID_BUTTON_INPUT_SHOW);
|
|
123 |
index = 0;
|
|
124 |
UINT nID, nStyle;
|
|
125 |
int iImage;
|
|
126 |
m_wndToolBar_InfoShow.GetButtonInfo(0, nID, nStyle, iImage);
|
|
127 |
m_wndToolBar_InfoShow.SetButtonInfo(index, nID, TBBS_SEPARATOR, 100);
|
|
128 |
m_wndToolBar_InfoShow.GetItemRect(0, &rect1);
|
|
129 |
rect1.left = 1;
|
|
130 |
rect1.top = 2;
|
|
131 |
rect1.right = rect1.left + 100;
|
|
132 |
rect1.bottom = rect1.top + 20;
|
|
133 |
if (!m_StaticShowMachine.Create(_T("Test1"), WS_CHILD | WS_VISIBLE | WS_EX_CLIENTEDGE, rect1, \
|
|
134 |
&m_wndToolBar_InfoShow, nID))
|
|
135 |
{
|
|
136 |
TRACE(_T("Failed to create CStaticEx\n"));
|
|
137 |
return FALSE;
|
|
138 |
}
|
|
139 |
//*/
|
|
140 |
// m_InputShowStatic.SetBkColor(RGB(255, 255, 255));
|
|
141 |
// m_InputShowStatic.SetTextColor(RGB(255, 128, 128));
|
|
142 |
// m_InputShowStatic.SetTextSize(20);
|
|
143 |
//m_InputShowEdit.SetReadOnly(true);
|
|
144 |
|
|
145 |
// m_wndToolBar_InfoShow.EnableDocking(CBRS_ALIGN_ANY);
|
|
146 |
// this->RecalcLayout();
|
|
147 |
// DockPane(&m_wndToolBar_InputShow);
|
|
148 |
|
|
149 |
return 0;
|
|
150 |
}
|