|
// ChildFrm.cpp: CChildFrame 类的实现
|
//
|
|
#include "pch.h"
|
#include "framework.h"
|
#include "MTerm2.h"
|
|
#include "ChildFrm.h"
|
|
#ifdef _DEBUG
|
#define new DEBUG_NEW
|
#endif
|
|
// CChildFrame
|
|
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
|
|
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
|
ON_WM_CREATE()
|
END_MESSAGE_MAP()
|
|
static UINT indicators[] =
|
{
|
ID_INDICATOR_MACHINE_TYPE, // 状态行指示器
|
ID_INDICATOR_PROGRAM_POS,
|
ID_INDICATOR_CONNECTIVITY,
|
ID_INDICATOR_RUN_STATUS,
|
ID_INDICATOR_MONITOR_STATUS,
|
ID_INDICATOR_TARGET_ADDRESS,
|
ID_INDICATOR_INFO_DISPLAY,
|
};
|
|
// CChildFrame 构造/析构
|
|
CChildFrame::CChildFrame() noexcept
|
{
|
// TODO: 在此添加成员初始化代码
|
}
|
|
CChildFrame::~CChildFrame()
|
{
|
}
|
|
|
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
|
{
|
// TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或样式
|
if( !CMDIChildWnd::PreCreateWindow(cs) )
|
return FALSE;
|
//修改窗口的类型为最大化样式
|
// cs.style = cs.style | WS_MAXIMIZE | WS_VISIBLE;
|
return TRUE;
|
}
|
|
// CChildFrame 诊断
|
|
#ifdef _DEBUG
|
void CChildFrame::AssertValid() const
|
{
|
CMDIChildWnd::AssertValid();
|
}
|
|
void CChildFrame::Dump(CDumpContext& dc) const
|
{
|
CMDIChildWnd::Dump(dc);
|
}
|
#endif //_DEBUG
|
|
// CChildFrame 消息处理程序
|
|
|
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
{
|
if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
|
return -1;
|
|
// TODO: 在此添加您专用的创建代码
|
this->ModifyStyle(WS_SIZEBOX,0);
|
///*
|
if (!m_wndStatusBar.Create(this , (WS_CHILD | WS_VISIBLE | CBRS_TOP), IDW_CHILD_STATUS_BAR))
|
{
|
TRACE0("未能创建状态栏\n");
|
return -1; // 未能创建
|
}
|
m_wndStatusBar.SetIndicators(indicators, sizeof(indicators) / sizeof(UINT));
|
|
//*/
|
this->ModifyStyle(0,WS_SIZEBOX);
|
|
/*
|
if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators) / sizeof(UINT)))
|
{
|
TRACE0("未能创建状态栏\n");
|
return -1; // 未能创建
|
}
|
*/
|
m_wndStatusBar.SetPaneInfo(0, 0, 0, 100);
|
m_wndStatusBar.SetPaneInfo(1, 0, 0, 100);
|
m_wndStatusBar.SetPaneInfo(2, 0, 0, 100);
|
//
|
// m_wndStatusBar.SetPaneText(0, _T("机型参数"), false);
|
// m_wndStatusBar.SetPaneText(1, _T("程序位置/总数"), false);
|
m_wndStatusBar.SetPaneInfo(6, 0, 0, 9999);
|
|
// m_wndStatusBar.MoveWindow(0, 0, 1800, 28);
|
// m_wndStatusBar.EnableDocking(CBRS_ALIGN_TOP);
|
// EnableDocking(CBRS_ALIGN_ANY);
|
// AdjustClientArea();
|
// DockPane(&m_wndStatusBar);
|
|
/*
|
if (!m_wndToolBar_InfoShow.CreateEx(this, TBSTYLE_FLAT,
|
WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,
|
CRect(1, 1, 1, 1), IDR_TOOLBAR_INFO_SHOW) ||
|
!m_wndToolBar_InfoShow.LoadToolBar(IDR_TOOLBAR_INFO_SHOW))
|
{
|
TRACE0("未能创建数字工具栏\n");
|
return -1; // 未能创建
|
}
|
CRect rect1;
|
int index = m_wndToolBar_InfoShow.CommandToIndex(ID_BUTTON_INPUT_SHOW);
|
index = 0;
|
UINT nID, nStyle;
|
int iImage;
|
m_wndToolBar_InfoShow.GetButtonInfo(0, nID, nStyle, iImage);
|
m_wndToolBar_InfoShow.SetButtonInfo(index, nID, TBBS_SEPARATOR, 100);
|
m_wndToolBar_InfoShow.GetItemRect(0, &rect1);
|
rect1.left = 1;
|
rect1.top = 2;
|
rect1.right = rect1.left + 100;
|
rect1.bottom = rect1.top + 20;
|
if (!m_StaticShowMachine.Create(_T("Test1"), WS_CHILD | WS_VISIBLE | WS_EX_CLIENTEDGE, rect1, \
|
&m_wndToolBar_InfoShow, nID))
|
{
|
TRACE(_T("Failed to create CStaticEx\n"));
|
return FALSE;
|
}
|
//*/
|
// m_InputShowStatic.SetBkColor(RGB(255, 255, 255));
|
// m_InputShowStatic.SetTextColor(RGB(255, 128, 128));
|
// m_InputShowStatic.SetTextSize(20);
|
//m_InputShowEdit.SetReadOnly(true);
|
|
// m_wndToolBar_InfoShow.EnableDocking(CBRS_ALIGN_ANY);
|
// this->RecalcLayout();
|
// DockPane(&m_wndTBar_InputShow);
|
|
return 0;
|
}
|