chenluhua1980
2025-12-17 e3729db9e5b77d253666d9c7287bf2ea84c05132
SourceCode/Bond/Servo/ServoDlg.cpp
@@ -96,6 +96,7 @@
   m_pTerminalDisplayDlg = nullptr;
   m_pObserver = nullptr;
   m_pPanelMaster = nullptr;
   m_pPanelProduction = nullptr;
   m_pPanelEquipment = nullptr;
   m_pPanelAttributes = nullptr;
   m_pPageGraph1 = nullptr;
@@ -422,10 +423,19 @@
   m_pTab->SetBkgndColor(RGB(222, 222, 222));
   ShowChildPage(0);
   // 读取面板宽
   CString strIniFile;
   strIniFile.Format(_T("%s\\%s.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir, (LPTSTR)(LPCTSTR)theApp.m_strAppFile);
   int nPanelWidth = GetPrivateProfileInt(_T("App"), _T("MasterPanelWidth"),
      int((double)GetSystemMetrics(SM_CXSCREEN) * 0.25), (LPTSTR)(LPCTSTR)strIniFile);
   m_pPanelMaster = new CPanelMaster();
   m_pPanelMaster->setPanelWidth(nPanelWidth);
   m_pPanelMaster->Create(IDD_PANEL_MASTER, this);
   m_pPanelMaster->ShowWindow(SW_SHOW);
   m_pPanelProduction = new CPanelProduction();
   m_pPanelProduction->setPanelWidth(nPanelWidth);
   m_pPanelProduction->Create(IDD_PANEL_PRODUCTION, this);
   m_pPanelProduction->ShowWindow(SW_SHOW);
   m_pPanelEquipment = new CPanelEquipment();
   m_pPanelEquipment->Create(IDD_PANEL_EQUIPMENT, this);
   m_pPanelAttributes = new CPanelAttributes();
@@ -756,6 +766,12 @@
      m_pPanelMaster = nullptr;
   }
   if (m_pPanelProduction != nullptr) {
      m_pPanelProduction->DestroyWindow();
      delete m_pPanelProduction;
      m_pPanelProduction = nullptr;
   }
   if (m_pPanelEquipment != nullptr) {
      m_pPanelEquipment->DestroyWindow();
      delete m_pPanelEquipment;
@@ -856,9 +872,16 @@
   
   int nPanelWidth = 0;
   if (m_pPanelMaster != nullptr) {
   if (m_pPanelMaster != nullptr && ::IsWindow(m_pPanelMaster->GetSafeHwnd())
      && m_pPanelMaster->IsWindowVisible()) {
      nPanelWidth = m_pPanelMaster->getPanelWidth();
      m_pPanelMaster->MoveWindow(x, y, nPanelWidth, y2 - y);
      x += nPanelWidth;
   }
   if (m_pPanelProduction != nullptr && m_pPanelProduction->IsWindowVisible()) {
      nPanelWidth = m_pPanelProduction->getPanelWidth();
      m_pPanelProduction->MoveWindow(x, y, nPanelWidth, y2 - y);
      x += nPanelWidth;
   }
@@ -965,7 +988,20 @@
LRESULT CServoDlg::OnPanelResize(WPARAM wParam, LPARAM lParam)
{
   int width = (int)wParam;
   // m_pPanel->SetPanelWidth(width);
   if (m_pPanelMaster != nullptr) {
      m_pPanelMaster->setPanelWidth(width);
   }
   if (m_pPanelProduction != nullptr) {
      m_pPanelProduction->setPanelWidth(width);
   }
   CString strIniFile, strValue;
   strIniFile.Format(_T("%s\\%s.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir, (LPTSTR)(LPCTSTR)theApp.m_strAppFile);
   strValue.Format(_T("%d"), width);
   WritePrivateProfileString(_T("App"), _T("MasterPanelWidth"),
      (LPTSTR)(LPCTSTR)strValue, (LPTSTR)(LPCTSTR)strIniFile);
   Resize();
   return 0;
@@ -1226,4 +1262,4 @@
   }
   return strText;
}
}