From bfe14e41fa5b07771d78af4511ba18d706bc23cc Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 28 七月 2025 17:07:52 +0800
Subject: [PATCH] 1.Spooling Config功能EAP模拟测试;
---
SourceCode/Bond/BondEq/View/UserManagerDlg.cpp | 200 +------------------------------------------------
1 files changed, 7 insertions(+), 193 deletions(-)
diff --git a/SourceCode/Bond/BondEq/View/UserManagerDlg.cpp b/SourceCode/Bond/BondEq/View/UserManagerDlg.cpp
index 10dddbd..a3de9ff 100644
--- a/SourceCode/Bond/BondEq/View/UserManagerDlg.cpp
+++ b/SourceCode/Bond/BondEq/View/UserManagerDlg.cpp
@@ -8,37 +8,27 @@
#include "InputDialog.h"
#include "NewCellTypes/GridCellCombo.h"
#include "NewCellTypes/GridCellNumeric.h"
-
#include <set>
const COLORREF CURR_USER_BK_COLOR = RGB(0, 255, 0);
// CUserManagerDlg 瀵硅瘽妗�
-IMPLEMENT_DYNAMIC(CUserManagerDlg, CDialogEx)
+IMPLEMENT_DYNAMIC(CUserManagerDlg, CBaseDlg)
CUserManagerDlg::CUserManagerDlg(CWnd* pParent /*=nullptr*/)
- : CDialogEx(IDD_DIALOG_USER_MANAGER, pParent)
+ : CBaseDlg(IDD_DIALOG_USER_MANAGER, pParent)
{
- m_nInitialWidth = 0;
- m_nInitialHeight = 0;
}
CUserManagerDlg::~CUserManagerDlg()
{
- for (auto& pair : m_mapFonts) {
- if (pair.second) {
- pair.second->DeleteObject();
- delete pair.second;
- }
- }
- m_mapFonts.clear();
}
void CUserManagerDlg::DoDataExchange(CDataExchange* pDX)
{
DDX_Control(pDX, IDC_CUSTOM_USER, m_gridUserManager);
- CDialogEx::DoDataExchange(pDX);
+ CBaseDlg::DoDataExchange(pDX);
}
void CUserManagerDlg::InitUserManager()
@@ -119,7 +109,7 @@
int nCurrNameRow = -1;
std::vector<std::vector<std::string>> usersData = userManager.getUsers();
if (!usersData.empty()) {
- m_gridUserManager.SetRowCount(usersData.size() + 1);
+ m_gridUserManager.SetRowCount((int)usersData.size() + 1);
for (int i = 0; i < usersData.size(); i++) {
int nRowIdx = i + 1;
@@ -350,111 +340,12 @@
return false;
}
-CFont* CUserManagerDlg::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 CUserManagerDlg::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 CUserManagerDlg::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 CUserManagerDlg::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(); // 鍒锋柊鎺т欢鏄剧ず
-}
-
-BEGIN_MESSAGE_MAP(CUserManagerDlg, CDialogEx)
- ON_WM_SIZE()
+BEGIN_MESSAGE_MAP(CUserManagerDlg, CBaseDlg)
ON_NOTIFY(GVN_COMBOSELCHANGE, IDC_CUSTOM_USER, &CUserManagerDlg::OnGridComboSelChange)
ON_BN_CLICKED(IDC_BUTTON_ADD, &CUserManagerDlg::OnBnClickedButtonAdd)
ON_BN_CLICKED(IDC_BUTTON_DEL, &CUserManagerDlg::OnBnClickedButtonDel)
ON_BN_CLICKED(IDOK, &CUserManagerDlg::OnBnClickedOk)
ON_BN_CLICKED(IDC_BUTTON_INSERT, &CUserManagerDlg::OnBnClickedButtonInsert)
- ON_WM_GETMINMAXINFO()
END_MESSAGE_MAP()
@@ -463,59 +354,10 @@
BOOL CUserManagerDlg::OnInitDialog()
{
- CDialogEx::OnInitDialog();
+ CBaseDlg::OnInitDialog();
// TODO: 鍦ㄦ娣诲姞棰濆鐨勫垵濮嬪寲
- CRect screenRect, dlgRect, clientRect;
SetWindowText(_T("鐢ㄦ埛绠$悊"));
- SystemParametersInfo(SPI_GETWORKAREA, 0, &screenRect, 0);
-
- 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() * 3;
- int dlgHeight = dlgRect.Height() * 3;
-
- 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);
// 鍒濆鍖栫敤鎴风鐞嗚〃鏍�
InitUserManager();
@@ -523,34 +365,6 @@
return TRUE; // return TRUE unless you set the focus to a control
// 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
}
-
-
-void CUserManagerDlg::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 CUserManagerDlg::OnGetMinMaxInfo(MINMAXINFO* lpMMI)
-{
- // TODO: 鍦ㄦ娣诲姞娑堟伅澶勭悊绋嬪簭浠g爜鍜�/鎴栬皟鐢ㄩ粯璁ゅ��
- lpMMI->ptMinTrackSize.x = 400; // 鏈�灏忓搴�
- lpMMI->ptMinTrackSize.y = 300; // 鏈�灏忛珮搴�
-
- CDialogEx::OnGetMinMaxInfo(lpMMI);
-}
-
void CUserManagerDlg::OnGridComboSelChange(NMHDR* pNMHDR, LRESULT* pResult)
{
@@ -726,5 +540,5 @@
}
userManager.setUsers(vecData);
- CDialogEx::OnOK();
+ CBaseDlg::OnOK();
}
--
Gitblit v1.9.3