From 829fe6c6bc33d53fda9c31fd45a37e1df87befff Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期五, 30 一月 2026 11:16:24 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang
---
SourceCode/Bond/BondEq/View/SystemLogManagerDlg.cpp | 219 +-----------------------------------------------------
1 files changed, 6 insertions(+), 213 deletions(-)
diff --git a/SourceCode/Bond/BondEq/View/SystemLogManagerDlg.cpp b/SourceCode/Bond/BondEq/View/SystemLogManagerDlg.cpp
index f5603fb..72a9a03 100644
--- a/SourceCode/Bond/BondEq/View/SystemLogManagerDlg.cpp
+++ b/SourceCode/Bond/BondEq/View/SystemLogManagerDlg.cpp
@@ -9,29 +9,20 @@
// CSystemLogManagerDlg 瀵硅瘽妗�
-IMPLEMENT_DYNAMIC(CSystemLogManagerDlg, CDialogEx)
+IMPLEMENT_DYNAMIC(CSystemLogManagerDlg, CBaseDlg)
CSystemLogManagerDlg::CSystemLogManagerDlg(CWnd* pParent /*=nullptr*/)
- : CDialogEx(IDD_DIALOG_SYSTEM_LOG_MANAGER, pParent)
+ : CBaseDlg(IDD_DIALOG_SYSTEM_LOG_MANAGER, pParent)
{
- m_nInitialWidth = 0;
- m_nInitialHeight = 0;
}
CSystemLogManagerDlg::~CSystemLogManagerDlg()
{
- for (auto& pair : m_mapFonts) {
- if (pair.second) {
- pair.second->DeleteObject();
- delete pair.second;
- }
- }
- m_mapFonts.clear();
}
void CSystemLogManagerDlg::DoDataExchange(CDataExchange* pDX)
{
- CDialogEx::DoDataExchange(pDX);
+ CBaseDlg::DoDataExchange(pDX);
DDX_Control(pDX, IDC_COMBO_TYPE, m_comboType);
DDX_Control(pDX, IDC_COMBO_USER, m_comboUser);
DDX_Control(pDX, IDC_DATETIMEPICKER_START, m_dateTimeStart);
@@ -161,24 +152,6 @@
UpdatePageInfo();
}
-CFont* CSystemLogManagerDlg::GetOrCreateFont(int nFontSize)
-{
- auto it = m_mapFonts.find(nFontSize);
- if (it != m_mapFonts.end()) {
- return it->second;
- }
-
- CFont* font = new CFont();
- LOGFONT logFont = { 0 };
- _tcscpy_s(logFont.lfFaceName, _T("Segoe UI"));
- logFont.lfHeight = -nFontSize;
- logFont.lfQuality = CLEARTYPE_QUALITY;
- font->CreateFontIndirect(&logFont);
- m_mapFonts[nFontSize] = font;
-
- return font;
-}
-
void CSystemLogManagerDlg::UpdatePageInfo()
{
// 鏍煎紡鍖栭〉鐮佷俊鎭负 "褰撳墠椤�/鎬婚〉鏁�"
@@ -187,112 +160,13 @@
m_staticPageNum.SetWindowText(pageInfo);
}
-void CSystemLogManagerDlg::SetDefaultFont()
-{
- CFont* defaultFont = GetOrCreateFont(12);
- // 閬嶅巻鎵�鏈夋帶浠讹紝搴旂敤榛樿瀛椾綋
- CWnd* pWnd = GetWindow(GW_CHILD);
- while (pWnd) {
- // 璺宠繃鐗规畩鎺т欢锛堝 MFCGridCtrl锛�
- TCHAR szClassName[256];
- GetClassName(pWnd->m_hWnd, szClassName, sizeof(szClassName));
- if (_tcsicmp(szClassName, _T("MFCGridCtrl")) == 0) {
- pWnd = pWnd->GetNextWindow();
- continue;
- }
-
- pWnd->SetFont(defaultFont, TRUE);
- pWnd = pWnd->GetNextWindow();
- }
-}
-
-void CSystemLogManagerDlg::AdjustControls(float dScaleX, float dScaleY)
-{
- CWnd* pWnd = GetWindow(GW_CHILD);
- while (pWnd) {
- int nCtrlID = pWnd->GetDlgCtrlID();
- if (nCtrlID != -1 && m_mapCtrlLayouts.find(nCtrlID) != m_mapCtrlLayouts.end())
- {
- CRect originalRect = m_mapCtrlLayouts[nCtrlID];
- CRect newRect(
- static_cast<int>(originalRect.left * dScaleX),
- static_cast<int>(originalRect.top * dScaleY),
- static_cast<int>(originalRect.right * dScaleX),
- static_cast<int>(originalRect.bottom * dScaleY));
-
- TCHAR szClassName[256];
- GetClassName(pWnd->m_hWnd, szClassName, sizeof(szClassName));
-
- if (_tcsicmp(szClassName, _T("ComboBox")) == 0) {
- CComboBox* pComboBox = (CComboBox*)pWnd;
- pComboBox->SetItemHeight(-1, newRect.Height()); // -1 琛ㄧず鎵�鏈夐」鐨勯珮搴�
- }
-
- if (_tcsicmp(szClassName, _T("MFCGridCtrl")) == 0) {
- CGridCtrl* pGridCtrl = (CGridCtrl*)pWnd;
- pGridCtrl->SetDefCellHeight(newRect.Height() / 21);
- pGridCtrl->ExpandColumnsToFit(TRUE);
- pGridCtrl->ExpandLastColumn();
- pGridCtrl->Invalidate();
- pGridCtrl->UpdateWindow();
- }
-
- pWnd->MoveWindow(&newRect);
- AdjustControlFont(pWnd, newRect.Width(), newRect.Height());
- }
- pWnd = pWnd->GetNextWindow();
- }
-}
-
-void CSystemLogManagerDlg::AdjustControlFont(CWnd* pWnd, int nWidth, int nHeight)
-{
- TCHAR szClassName[256];
- GetClassName(pWnd->m_hWnd, szClassName, sizeof(szClassName));
-
- // 璺宠繃鐗规畩鎺т欢锛堝 MFCGridCtrl锛�
- if (_tcsicmp(szClassName, _T("MFCGridCtrl")) == 0) {
- return;
- }
-
- // 鏍规嵁鎺т欢楂樺害鍔ㄦ�佽皟鏁村瓧浣撳ぇ灏�
- int fontSize = nHeight / 2;
- if (fontSize < 8) fontSize = 8;
-
- // 鑾峰彇鎴栧垱寤哄瓧浣�
- CFont* pFont = GetOrCreateFont(fontSize);
-
- pWnd->SetFont(pFont);
- pWnd->Invalidate(); // 鍒锋柊鎺т欢鏄剧ず
-}
-
-
-void CSystemLogManagerDlg::AdjustComboBoxStyle(CComboBox& comboBox)
-{
- DWORD dwStyle = comboBox.GetStyle();
- comboBox.ModifyStyle(0, CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_OWNERDRAWFIXED);
-
- comboBox.Invalidate();
- comboBox.UpdateWindow();
-}
-
-
-void CSystemLogManagerDlg::AdjustDateTimeCtrlStyle(CDateTimeCtrl& dateTimeCtrl)
-{
- dateTimeCtrl.ModifyStyle(0, DTS_RIGHTALIGN);
- dateTimeCtrl.Invalidate();
- dateTimeCtrl.UpdateWindow();
-}
-
-
-BEGIN_MESSAGE_MAP(CSystemLogManagerDlg, CDialogEx)
+BEGIN_MESSAGE_MAP(CSystemLogManagerDlg, CBaseDlg)
ON_BN_CLICKED(IDC_BUTTON_SEARCH, &CSystemLogManagerDlg::OnBnClickedButtonSearch)
ON_BN_CLICKED(IDC_BUTTON_PREV_PAGE, &CSystemLogManagerDlg::OnBnClickedButtonPrevPage)
ON_BN_CLICKED(IDC_BUTTON_NEXT_PAGE, &CSystemLogManagerDlg::OnBnClickedButtonNextPage)
ON_CBN_SELCHANGE(IDC_COMBO_TYPE, &CSystemLogManagerDlg::OnSelchangeComboType)
ON_CBN_SELCHANGE(IDC_COMBO_USER, &CSystemLogManagerDlg::OnSelchangeComboUser)
- ON_WM_SIZE()
- ON_WM_GETMINMAXINFO()
END_MESSAGE_MAP()
@@ -301,7 +175,7 @@
BOOL CSystemLogManagerDlg::OnInitDialog()
{
- CDialogEx::OnInitDialog();
+ CBaseDlg::OnInitDialog();
// TODO: 鍦ㄦ娣诲姞棰濆鐨勫垵濮嬪寲
SetWindowText(_T("绯荤粺杩愯鏃ュ織"));
@@ -330,88 +204,11 @@
COleDateTime defaultStartTime = currentTime - COleDateTimeSpan(30, 0, 0, 0);
m_dateTimeStart.SetTime(defaultStartTime);
- CRect screenRect, dlgRect, clientRect;
- GetClientRect(&clientRect);
- m_nInitialWidth = clientRect.Width();
- m_nInitialHeight = clientRect.Height();
-
- // 鍒濆鍖栭粯璁ゅ瓧浣�
- CFont* pDefaultFont = GetOrCreateFont(12);
-
- // 閬嶅巻鎵�鏈夊瓙鎺т欢锛岃褰曞垵濮嬩綅缃苟璁剧疆榛樿瀛椾綋
- CWnd* pWnd = GetWindow(GW_CHILD);
- while (pWnd) {
- int nCtrlID = pWnd->GetDlgCtrlID();
- if (nCtrlID != -1) {
- // 璁板綍鎺т欢鍒濆甯冨眬
- CRect ctrlRect;
- pWnd->GetWindowRect(&ctrlRect);
- ScreenToClient(&ctrlRect);
- m_mapCtrlLayouts[nCtrlID] = ctrlRect;
-
- // 璺宠繃鐗规畩鎺т欢锛堝 MFCGridCtrl锛�
- TCHAR szClassName[256];
- GetClassName(pWnd->m_hWnd, szClassName, sizeof(szClassName));
- if (_tcsicmp(szClassName, _T("MFCGridCtrl")) == 0) {
- pWnd = pWnd->GetNextWindow();
- continue;
- }
-
- // 璁剧疆榛樿瀛椾綋
- pWnd->SetFont(pDefaultFont);
- }
- pWnd = pWnd->GetNextWindow();
- }
-
- GetWindowRect(&dlgRect);
- int dlgWidth = dlgRect.Width() * 2;
- int dlgHeight = dlgRect.Height() * 2;
-
- SystemParametersInfo(SPI_GETWORKAREA, 0, &screenRect, 0);
- if (dlgWidth > screenRect.Width()) {
- dlgWidth = screenRect.Width();
- }
- if (dlgHeight > screenRect.Height()) {
- dlgHeight = screenRect.Height();
- }
-
- int centerX = screenRect.left + (screenRect.Width() - dlgWidth) / 2;
- int centerY = screenRect.top + (screenRect.Height() - dlgHeight) / 2;
- MoveWindow(centerX, centerY, dlgWidth, dlgHeight);
-
InitSystemLogManager();
return TRUE; // return TRUE unless you set the focus to a control
// 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
}
-
-
-void CSystemLogManagerDlg::OnSize(UINT nType, int cx, int cy)
-{
- CDialogEx::OnSize(nType, cx, cy);
-
- // TODO: 鍦ㄦ澶勬坊鍔犳秷鎭鐞嗙▼搴忎唬鐮�
- if (nType == SIZE_MINIMIZED || m_mapCtrlLayouts.empty()) {
- return;
- }
-
- float dScaleX = static_cast<float>(cx) / m_nInitialWidth;
- float dScaleY = static_cast<float>(cy) / m_nInitialHeight;
-
- // 閬嶅巻瀵硅瘽妗嗕腑鐨勬墍鏈夋帶浠�
- AdjustControls(dScaleX, dScaleY);
-}
-
-
-void CSystemLogManagerDlg::OnGetMinMaxInfo(MINMAXINFO* lpMMI)
-{
- // TODO: 鍦ㄦ娣诲姞娑堟伅澶勭悊绋嬪簭浠g爜鍜�/鎴栬皟鐢ㄩ粯璁ゅ��
- lpMMI->ptMinTrackSize.x = 400; // 鏈�灏忓搴�
- lpMMI->ptMinTrackSize.y = 300; // 鏈�灏忛珮搴�
-
- CDialogEx::OnGetMinMaxInfo(lpMMI);
-}
-
void CSystemLogManagerDlg::OnBnClickedButtonSearch()
{
@@ -426,7 +223,6 @@
AfxMessageBox(errorMsg, MB_ICONERROR);
}
}
-
void CSystemLogManagerDlg::OnBnClickedButtonPrevPage()
{
@@ -447,7 +243,6 @@
}
}
-
void CSystemLogManagerDlg::OnBnClickedButtonNextPage()
{
// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
@@ -467,7 +262,6 @@
}
}
-
void CSystemLogManagerDlg::OnSelchangeComboType()
{
// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
@@ -482,7 +276,6 @@
}
}
-
void CSystemLogManagerDlg::OnSelchangeComboUser()
{
// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
@@ -495,4 +288,4 @@
errorMsg.Format(_T("鍒囨崲瑙掕壊澶辫触锛�%s"), CString(ex.what()));
AfxMessageBox(errorMsg, MB_ICONERROR);
}
-}
\ No newline at end of file
+}
--
Gitblit v1.9.3