| | |
| | | void CAxisSettingsDlg::UpdatePageButtonStates() |
| | | { |
| | | for (int i = 0; i < AXIS_PAGE_SIZE; ++i) { |
| | | m_pBlBtns[i]->SetFrameColor(BTN_PAGE_FRAME_COLOR); |
| | | BOOL bSelect = (i + 1 == m_currentPage); |
| | | m_pBlBtns[i]->SetFaceColor(bSelect ? |
| | | BTN_PAGE_FACE_SELECT_COLOR: BTN_PAGE_FACE_NORMAL_COLOR); |
| | |
| | | } |
| | | ASSERT(m_pActiveView); |
| | | if (m_pActiveView->GetContext() != (void*)pPlc) { |
| | | m_pActiveView->SetWindowText(pPlc->getName().c_str()); |
| | | CString strTitle; |
| | | strTitle.Format(_T("%s[%s:%d]"), pPlc->getName().c_str(), pPlc->getIp().c_str(), |
| | | pPlc->getPort()); |
| | | m_pActiveView->SetWindowText(strTitle); |
| | | m_pActiveView->SetContext(pPlc); |
| | | m_pActiveView->SendMessage(WM_NCPAINT, 0, 0); |
| | | } |
| | |
| | | /* 轴设定页面颜色定义 */ |
| | | |
| | | /* 5个按钮页, 按钮背景色,正常状态*/ |
| | | #define BTN_PAGE_FRAME_COLOR RGB(58, 58, 58) |
| | | #define BTN_PAGE_FACE_NORMAL_COLOR RGB(0, 168, 0) |
| | | #define BTN_PAGE_FACE_SELECT_COLOR RGB(0, 232, 0) |
| | | #define BTN_PAGE_TEXT_NORMAL_COLOR RGB(22, 22, 22) |
| | |
| | | for (int i = 0; i < BTN_MAX; i++) { |
| | | m_pBlBtns[i] = new CBlButton(); |
| | | } |
| | | m_crPlcNameBack = RGB(228, 228, 228); |
| | | |
| | | } |
| | | |
| | | CPlcView::~CPlcView() |
| | | { |
| | | for (int i = 0; i < BTN_MAX; i++) { |
| | | delete m_pBlBtns[i]; |
| | | } |
| | | if (m_hbrPlcName != nullptr) { |
| | | ::DeleteObject(m_hbrPlcName); |
| | | m_hbrPlcName = nullptr; |
| | | } |
| | | } |
| | | |
| | |
| | | HBRUSH CPlcView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) |
| | | { |
| | | HBRUSH hbr = CBaseView::OnCtlColor(pDC, pWnd, nCtlColor); |
| | | int nCtrlId = pWnd->GetDlgCtrlID(); |
| | | |
| | | if (nCtlColor == CTLCOLOR_STATIC) { |
| | | pDC->SetBkColor(m_crBkgnd); |
| | | } |
| | | |
| | | if (IDC_LABEL_PLC_NAME == nCtrlId) { |
| | | pDC->SetBkColor(m_crPlcNameBack); |
| | | m_hbrPlcName = CreateSolidBrush(m_crPlcNameBack); |
| | | return m_hbrPlcName; |
| | | } |
| | | |
| | | if (m_hbrBkgnd == nullptr) { |
| | | m_hbrBkgnd = CreateSolidBrush(m_crBkgnd); |
| | | } |
| | |
| | | private: |
| | | // 控件 |
| | | CBlButton* m_pBlBtns[BTN_MAX]; |
| | | COLORREF m_crPlcNameBack; |
| | | HBRUSH m_hbrPlcName; |
| | | |
| | | // 对话框数据 |
| | | #ifdef AFX_DESIGN_TIME |