From fec3ff7b0bb0a4e53c2f9ff26cd06659a0c8aff9 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期二, 07 一月 2025 11:08:34 +0800
Subject: [PATCH] 1.工具条; 2.左侧PLC列表;

---
 SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp |   46 ++++++++++++++++++++++++++++++++--------------
 1 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp b/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp
index a7524f9..a0db823 100644
--- a/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp
+++ b/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;
 }

--
Gitblit v1.9.3