From aac3b319965967f465881f3a8961904d57b6f337 Mon Sep 17 00:00:00 2001 From: zxd <zxdvslxy@gmail.com> Date: 星期四, 28 九月 2023 17:01:41 +0800 Subject: [PATCH] 节前提交,包含部分图码的转换,提出单独函数专做转换 --- MTerm1/ChildFrm.cpp | 95 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 94 insertions(+), 1 deletions(-) diff --git a/MTerm1/ChildFrm.cpp b/MTerm1/ChildFrm.cpp index 927cfb7..6b17f06 100644 --- a/MTerm1/ChildFrm.cpp +++ b/MTerm1/ChildFrm.cpp @@ -17,7 +17,19 @@ IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWndEx) BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWndEx) + 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 鏋勯��/鏋愭瀯 @@ -36,7 +48,8 @@ // TODO: 鍦ㄦ澶勯�氳繃淇敼 CREATESTRUCT cs 鏉ヤ慨鏀圭獥鍙g被鎴栨牱寮� if( !CMDIChildWndEx::PreCreateWindow(cs) ) return FALSE; - + //淇敼绐楀彛鐨勭被鍨嬩负鏈�澶у寲鏍峰紡 +// cs.style = cs.style | WS_MAXIMIZE | WS_VISIBLE; return TRUE; } @@ -55,3 +68,83 @@ #endif //_DEBUG // CChildFrame 娑堟伅澶勭悊绋嬪簭 + + +int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CMDIChildWndEx::OnCreate(lpCreateStruct) == -1) + return -1; + + // TODO: 鍦ㄦ娣诲姞鎮ㄤ笓鐢ㄧ殑鍒涘缓浠g爜 + 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; +} -- Gitblit v1.9.1