LAPTOP-SNT8I5JK\Boounion
2025-01-07 fec3ff7b0bb0a4e53c2f9ff26cd06659a0c8aff9
SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp
@@ -6,6 +6,7 @@
#include "BoounionPLC.h"
#include "BoounionPLCDlg.h"
#include "afxdialogex.h"
#include "Common.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@@ -54,6 +55,8 @@
{
   m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
   m_pTopToolbar = nullptr;
   m_crBkgnd = APP_MAIN_DLG_BACKGROUND;
   m_hbrBkgnd = nullptr;
}
void CBoounionPLCDlg::DoDataExchange(CDataExchange* pDX)
@@ -107,13 +110,18 @@
   m_pTopToolbar = new CTopToolbar();
   m_pTopToolbar->Create(IDD_TOP_TOOLBAR, this);
   m_pTopToolbar->ShowWindow(SW_SHOW);
   m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(FALSE);
   m_pTopToolbar->GetBtn(IDC_BUTTON_ALARM)->EnableWindow(FALSE);
   HMENU hMenu = m_pTopToolbar->GetOperatorMenu();
   ASSERT(hMenu);
   ::EnableMenuItem(hMenu, ID_OPEATOR_SWITCH, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
   
   // page plc list
   m_pPagePlcList = new CPagePlcList();
   m_pPagePlcList->Create(IDD_PAGE_PLC_LIST, this);
   m_pPagePlcList->ShowWindow(SW_SHOW);
   ShowWindow(SW_MAXIMIZE);
   Resize();
@@ -179,6 +187,17 @@
      delete m_pTopToolbar;
      m_pTopToolbar = nullptr;
   }
   if (m_pPagePlcList != nullptr) {
      m_pPagePlcList->DestroyWindow();
      delete m_pPagePlcList;
      m_pPagePlcList = nullptr;
   }
   if (m_hbrBkgnd != nullptr) {
      ::DeleteObject(m_hbrBkgnd);
      m_hbrBkgnd = nullptr;
   }
}
@@ -190,7 +209,8 @@
   Resize();
}
#define TOOLBAR_HEIGHT      78
#define TOOLBAR_HEIGHT         78
#define PAGE_PLC_LIST_WIDTH      218
void CBoounionPLCDlg::Resize()
{
   CRect rcClient, rcItem;
@@ -200,14 +220,7 @@
   m_pTopToolbar->MoveWindow(0, 0, rcClient.Width(), TOOLBAR_HEIGHT);
   y += TOOLBAR_HEIGHT;
   /*
   ASSERT(m_pPanelProject);
   int nPanelEquipmentWidth = m_pPanelProject->GetPanelWidth();
   m_pPanelProject->MoveWindow(0, y, nPanelEquipmentWidth, rcClient.bottom - y);
   int x = nPanelEquipmentWidth;
   m_pMainContainer->MoveWindow(x + 1, y, rcClient.Width() - x - 0, rcClient.bottom - y - 2);
   */
   m_pPagePlcList->MoveWindow(0, y, PAGE_PLC_LIST_WIDTH, rcClient.Height() - y - 2);
}
@@ -215,8 +228,13 @@
{
   HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
   // TODO:  在此更改 DC 的任何特性
   if (nCtlColor == CTLCOLOR_STATIC) {
      pDC->SetBkColor(m_crBkgnd);
   }
   // TODO:  如果默认的不是所需画笔,则返回另一个画笔
   return hbr;
   if (m_hbrBkgnd == nullptr) {
      m_hbrBkgnd = CreateSolidBrush(m_crBkgnd);
   }
   return m_hbrBkgnd;
}