| | |
| | | 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; |
| | |
| | | int fontSize = nHeight / 2; |
| | | if (fontSize < 8) fontSize = 8; |
| | | |
| | | // 检查字体是否已经存在 |
| | | auto it = m_mapFonts.find(fontSize); |
| | | if (it == m_mapFonts.end()) { |
| | | // 动态创建新字体 |
| | | CFont* newFont = new CFont(); |
| | | LOGFONT logFont = { 0 }; |
| | | _tcscpy_s(logFont.lfFaceName, _T("Segoe UI")); |
| | | logFont.lfHeight = -fontSize; |
| | | logFont.lfQuality = CLEARTYPE_QUALITY; // 启用 ClearType 抗锯齿 |
| | | newFont->CreateFontIndirect(&logFont); |
| | | // 获取或创建字体 |
| | | CFont* pFont = GetOrCreateFont(fontSize); |
| | | |
| | | // 存储到字体管理容器中 |
| | | m_mapFonts[fontSize] = newFont; |
| | | it = m_mapFonts.find(fontSize); |
| | | } |
| | | |
| | | pWnd->SetFont(it->second); |
| | | pWnd->SetFont(pFont); |
| | | pWnd->Invalidate(); // 刷新控件显示 |
| | | } |
| | | |