| | |
| | | // 根据控件高度动态调整字体大小 |
| | | int fontSize = nHeight / 2; |
| | | if (fontSize < 8) fontSize = 8; |
| | | if (fontSize < 24) fontSize = 24; |
| | | |
| | | // 获取或创建字体 |
| | | CFont* pFont = GetOrCreateFont(fontSize); |
| | |
| | | int startIndex = (m_nCurrentPage - 1) * m_nRowsPerPage; |
| | | int endIndex = min(startIndex + m_nRowsPerPage, static_cast<int>(m_displayData.size())); |
| | | |
| | | for (int i = startIndex; i < endIndex; ++i) |
| | | { |
| | | const auto& data = m_displayData[i]; |
| | | int row = i - startIndex; |
| | | for (int i = 0; i < m_nRowsPerPage; ++i) { |
| | | int row = i; |
| | | |
| | | m_staticControls[row * m_nCols + 0]->SetWindowText(_T("OFF")); |
| | | m_staticControls[row * m_nCols + 1]->SetWindowText(CString(data.inputAddress.c_str())); |
| | | m_staticControls[row * m_nCols + 2]->SetWindowText(CString(data.inputDescription.c_str())); |
| | | m_staticControls[row * m_nCols + 3]->SetWindowText(_T("OFF")); |
| | | m_staticControls[row * m_nCols + 4]->SetWindowText(CString(data.outputAddress.c_str())); |
| | | m_staticControls[row * m_nCols + 5]->SetWindowText(CString(data.outputDescription.c_str())); |
| | | if (startIndex + i < endIndex) { |
| | | const auto& data = m_displayData[startIndex + i]; |
| | | |
| | | // 显示控件并设置内容 |
| | | m_staticControls[row * m_nCols + 0]->SetWindowText(_T("OFF")); |
| | | m_staticControls[row * m_nCols + 0]->ShowWindow(SW_SHOW); |
| | | |
| | | m_staticControls[row * m_nCols + 1]->SetWindowText(CString(data.inputAddress.c_str())); |
| | | m_staticControls[row * m_nCols + 1]->ShowWindow(SW_SHOW); |
| | | |
| | | m_staticControls[row * m_nCols + 2]->SetWindowText(CString(data.inputDescription.c_str())); |
| | | m_staticControls[row * m_nCols + 2]->ShowWindow(SW_SHOW); |
| | | |
| | | m_staticControls[row * m_nCols + 3]->SetWindowText(_T("OFF")); |
| | | m_staticControls[row * m_nCols + 3]->ShowWindow(SW_SHOW); |
| | | |
| | | m_staticControls[row * m_nCols + 4]->SetWindowText(CString(data.outputAddress.c_str())); |
| | | m_staticControls[row * m_nCols + 4]->ShowWindow(SW_SHOW); |
| | | |
| | | m_staticControls[row * m_nCols + 5]->SetWindowText(CString(data.outputDescription.c_str())); |
| | | m_staticControls[row * m_nCols + 5]->ShowWindow(SW_SHOW); |
| | | } |
| | | else { |
| | | // 隐藏这一行的所有控件 |
| | | for (int col = 0; col < m_nCols; ++col) |
| | | { |
| | | m_staticControls[row * m_nCols + col]->ShowWindow(SW_HIDE); |
| | | } |
| | | } |
| | | } |
| | | |
| | | UpdatePageInfo(); |
| | | } |
| | | |