From b9f5d0325af5dacf98e245a3b897d2ea44ea4790 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期四, 11 九月 2025 10:10:59 +0800
Subject: [PATCH] 1.超长内容弹出消息框显示; 2.修复WIP增加或减少,报表没有对应动作的问题;
---
SourceCode/Bond/Servo/CExpandableListCtrl.cpp | 63 +++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 1 deletions(-)
diff --git a/SourceCode/Bond/Servo/CExpandableListCtrl.cpp b/SourceCode/Bond/Servo/CExpandableListCtrl.cpp
index 9022dce..ef21ed0 100644
--- a/SourceCode/Bond/Servo/CExpandableListCtrl.cpp
+++ b/SourceCode/Bond/Servo/CExpandableListCtrl.cpp
@@ -3,7 +3,11 @@
IMPLEMENT_DYNAMIC(CExpandableListCtrl, CListCtrl)
-CExpandableListCtrl::CExpandableListCtrl() {}
+CExpandableListCtrl::CExpandableListCtrl()
+{
+ m_popupCols = { };
+}
+
CExpandableListCtrl::~CExpandableListCtrl() {}
BEGIN_MESSAGE_MAP(CExpandableListCtrl, CListCtrl)
@@ -249,6 +253,38 @@
}
}
}
+
+ // 鈥斺�� 鑻ョ偣鍑诲埌闇�瑕佲�滃叏鏂囨樉绀衡�濈殑鍒楋紝鍒欏悜鐖剁獥鍙e彂閫佽嚜瀹氫箟閫氱煡 鈥斺�� //
+ if (!m_popupCols.empty()) {
+ LPNMITEMACTIVATE pia = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
+
+ // 鐢� SubItemHitTest 鏇寸簿鍑嗘嬁鍒板垪
+ LVHITTESTINFO ht{};
+ ht.pt = pia->ptAction;
+ int hit = SubItemHitTest(&ht);
+ if (hit >= 0 && ht.iItem >= 0 && ht.iSubItem >= 0) {
+ const int row = ht.iItem;
+ const int col = ht.iSubItem;
+
+ if (m_popupCols.count(col)) {
+ CString full = GetItemText(row, col);
+ if (!full.IsEmpty() && _IsCellTruncated(row, col, full)) {
+ NMC_ELC_SHOWFULLTEXT nm{};
+ nm.hdr.hwndFrom = m_hWnd;
+ nm.hdr.idFrom = GetDlgCtrlID();
+ nm.hdr.code = ELCN_SHOWFULLTEXT;
+ nm.iItem = row;
+ nm.iSubItem = col;
+ nm.text = full;
+
+ if (CWnd* pParent = GetParent()) {
+ pParent->SendMessage(WM_NOTIFY, nm.hdr.idFrom, reinterpret_cast<LPARAM>(&nm));
+ }
+ }
+ }
+ }
+ }
+
*pResult = 0;
}
@@ -441,4 +477,29 @@
Invalidate();
}
+void CExpandableListCtrl::SetPopupFullTextColumns(const std::vector<int>& cols)
+{
+ m_popupCols.clear();
+ for (int c : cols) m_popupCols.insert(c);
+}
+
+bool CExpandableListCtrl::_IsCellTruncated(int row, int col, const CString& text) const
+{
+ if (text.IsEmpty()) return false;
+
+ // 鍗曞厓鏍兼樉绀哄尯鍩熷搴�
+ CRect rcCell;
+ if (!const_cast<CExpandableListCtrl*>(this)->GetSubItemRect(row, col, LVIR_BOUNDS, rcCell))
+ return false;
+
+ // 鐢ㄦ帶浠跺瓧浣撴祴閲忔枃鏈儚绱犲
+ CClientDC dc(const_cast<CExpandableListCtrl*>(this));
+ CFont* pOld = dc.SelectObject(const_cast<CExpandableListCtrl*>(this)->GetFont());
+ CSize sz = dc.GetTextExtent(text);
+ dc.SelectObject(pOld);
+
+ const int kPadding = 8; // 棰勭暀涓�鐐硅竟璺�/鐪佺暐鍙蜂綑閲�
+ return sz.cx > (rcCell.Width() - kPadding);
+}
+
--
Gitblit v1.9.3