From 5948c336569b608b6def60b37f8cdaa10ac41dff Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期四, 11 十二月 2025 11:01:47 +0800
Subject: [PATCH] 1.Report增加三按钮;
---
SourceCode/Bond/Servo/CPageReport.h | 2 ++
SourceCode/Bond/Servo/CPageReport.cpp | 25 +++++++++++++++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/Servo/CPageReport.cpp b/SourceCode/Bond/Servo/CPageReport.cpp
index 0066c9b..ca178ef 100644
--- a/SourceCode/Bond/Servo/CPageReport.cpp
+++ b/SourceCode/Bond/Servo/CPageReport.cpp
@@ -32,6 +32,7 @@
ON_WM_CTLCOLOR()
ON_WM_DESTROY()
ON_WM_SIZE()
+ ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST1, &CPageReport::OnLvnItemchangedList1)
END_MESSAGE_MAP()
@@ -123,3 +124,27 @@
m_listCtrl.SetItemText(index, 2, item->getVariablesIdsText().c_str());
}
}
+
+void CPageReport::OnCreateBtns()
+{
+ const int BTN_W = 80;
+ const int BTN_H = 28;
+ CreateBtn(_T("鏂板"), BTN_W, BTN_H, 2001);
+ CreateBtn(_T("鍒犻櫎"), BTN_W, BTN_H, 2002)->EnableWindow(FALSE);
+ CreateBtn(_T("缂栬緫"), BTN_W, BTN_H, 2003)->EnableWindow(FALSE);
+}
+
+void CPageReport::OnLvnItemchangedList1(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
+ int nSelCount = m_listCtrl.GetSelectedCount();
+
+ if (CButton* pDel = GetBtnByName("鍒犻櫎")) {
+ pDel->EnableWindow(nSelCount > 0);
+ }
+ if (CButton* pEdit = GetBtnByName("缂栬緫")) {
+ pEdit->EnableWindow(nSelCount > 0);
+ }
+
+ *pResult = 0;
+}
diff --git a/SourceCode/Bond/Servo/CPageReport.h b/SourceCode/Bond/Servo/CPageReport.h
index 716ac0b..6cea3e4 100644
--- a/SourceCode/Bond/Servo/CPageReport.h
+++ b/SourceCode/Bond/Servo/CPageReport.h
@@ -16,6 +16,7 @@
private:
CListCtrlEx m_listCtrl;
+ void OnCreateBtns() override;
// 瀵硅瘽妗嗘暟鎹�
#ifdef AFX_DESIGN_TIME
@@ -31,4 +32,5 @@
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
afx_msg void OnDestroy();
afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg void OnLvnItemchangedList1(NMHDR* pNMHDR, LRESULT* pResult);
};
--
Gitblit v1.9.3