From cb3d913e147acce92bfacc34dab441abb9ab8735 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期二, 04 三月 2025 16:24:52 +0800
Subject: [PATCH] 1.属性页面板增加关闭按钮,关闭时隐藏,默认隐藏。
---
SourceCode/Bond/Servo/CPanelAttributes.cpp | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/SourceCode/Bond/Servo/CPanelAttributes.cpp b/SourceCode/Bond/Servo/CPanelAttributes.cpp
index ef815ae..e36312d 100644
--- a/SourceCode/Bond/Servo/CPanelAttributes.cpp
+++ b/SourceCode/Bond/Servo/CPanelAttributes.cpp
@@ -37,6 +37,7 @@
ON_WM_DESTROY()
ON_WM_SIZE()
ON_NOTIFY(BYVERTICALLINE_MOVEX, IDC_LINE1, &CPanelAttributes::OnVLineMoveX)
+ ON_BN_CLICKED(IDC_BUTTON_CLOSE, &CPanelAttributes::OnBnClickedButtonClose)
END_MESSAGE_MAP()
@@ -62,11 +63,10 @@
for (unsigned int i = 0; i < nSize; i++) {
SERVO::CAttribute* pAttribute = attrubutes.getAttribute(i);
- CMFCPropertyGridProperty* pProp1 = new CMFCPropertyGridProperty(
+ m_gridCtrl.AddProperty(new CMFCPropertyGridProperty(
pAttribute->getName().c_str(),
pAttribute->getValue().c_str(),
- pAttribute->getDescription().c_str());
- m_gridCtrl.AddProperty(pProp1);
+ pAttribute->getDescription().c_str()));
}
}
@@ -74,6 +74,19 @@
{
CDialogEx::OnInitDialog();
+
+ // 鍏抽棴鎸夐挳
+ CString strIcon1;
+ strIcon1.Format(_T("%s\\Res\\panel_close_24_b.ico"), theApp.m_strAppDir);
+ HICON hIcon1 = (HICON)::LoadImage(AfxGetInstanceHandle(),
+ strIcon1, IMAGE_ICON, 24, 24,
+ LR_LOADFROMFILE | LR_DEFAULTCOLOR | LR_CREATEDIBSECTION | LR_DEFAULTSIZE);
+ m_btnClose.SubclassDlgItem(IDC_BUTTON_CLOSE, this);
+ m_btnClose.SetIcon(hIcon1, hIcon1, 24);
+ m_btnClose.SetFaceColor(m_crBkgnd);
+ m_btnClose.SetFrameColor(m_crBkgnd);
+ m_btnClose.SetFrameColor(BS_HOVER, RGB(218, 218, 218));
+ m_btnClose.SetFrameColor(BS_PRESS, RGB(168, 168, 168));
CVerticalLine* pLine1 = CVerticalLine::Hook(GetDlgItem(IDC_LINE1)->GetSafeHwnd());
pLine1->SetBkgndColor(RGB(225, 225, 225));
@@ -137,6 +150,10 @@
pItem = GetDlgItem(IDC_LABEL_TITLE);
pItem->GetWindowRect(&rcItem);
pItem->MoveWindow(5, y, rcClient.Width() - 8, rcItem.Height());
+
+ pItem = GetDlgItem(IDC_BUTTON_CLOSE);
+ pItem->GetWindowRect(&rcItem);
+ pItem->MoveWindow(rcClient.right - 6 - rcItem.Width(), y, rcItem.Width(), rcItem.Height());
y += rcItem.Height();
y += 3;
@@ -163,3 +180,9 @@
*result = 0;
}
+
+void CPanelAttributes::OnBnClickedButtonClose()
+{
+ ShowWindow(SW_HIDE);
+ GetParent()->SendMessage(ID_MSG_PANEL_RESIZE, m_nPanelWidth, 0);
+}
--
Gitblit v1.9.3