void CUIComboBox::DoPaint(HDC hDC, const RECT& rcPaint) { // Paint the nice frame int cy = m_rcItem.bottom - m_rcItem.top; ::SetRect(&m_rcButton, m_rcItem.right - cy, m_rcItem.top, m_rcItem.right, m_rcItem.bottom); RECT rcText = { m_rcItem.left + 5, m_rcItem.top, m_rcButton.left + 1, m_rcItem.bottom }; UINT uState = m_uButtonState; if( IsFocused() ) uState |= UISTATE_FOCUSED; if( !IsEnabled() ) uState |= UISTATE_DISABLED; RECT rcPadding = { 0 }; // Paint dropdown button if (m_pImageOwner != NULL) { RECT rcImage = {0}; int nWidth = m_pImageOwner->GetWidth() / 4; int nHeight = m_pImageOwner->GetHeight(); // Draw frame and body if( (uState & UISTATE_DISABLED) != 0 ) { RECT rcTemp = {nWidth *3, 0, nWidth * 4, nHeight}; rcImage = rcTemp; } else if( (uState & UISTATE_PUSHED) != 0 ) { RECT rcTemp ={nWidth *2, 0, nWidth * 3, nHeight}; rcImage = rcTemp; } else if( (uState & UISTATE_HOT) != 0 ) { RECT rcTemp ={nWidth *1, 0, nWidth * 2, nHeight}; rcImage = rcTemp; } else { RECT rcTemp ={nWidth *0, 0, nWidth * 1, nHeight}; rcImage = rcTemp; } CUIBlueRenderEngine::DoFillRect(hDC, m_pManager, m_rcItem, rcImage, m_pImageOwner); } else { CUIBlueRenderEngine::DoPaintButton(hDC, m_pManager, m_rcItem, uState, NULL, 0); } if (m_sText.GetLength() > 0) { UITYPE_COLOR clrText; if( (m_uButtonState & UISTATE_DISABLED) != 0 ) { clrText = UICOLOR_BUTTON_TEXT_DISABLED; } else if( (m_uButtonState & UISTATE_PUSHED) != 0 ) { clrText = UICOLOR_BUTTON_TEXT_PUSHED; } else { clrText = UICOLOR_BUTTON_TEXT_NORMAL; } RECT rcText = m_rcItem; ::InflateRect(&rcText, -1, -1); rcText.left += rcPadding.left; rcText.top += rcPadding.top; rcText.right -= rcPadding.right; rcText.bottom -= rcPadding.bottom; int nLinks = 0; CUIBlueRenderEngine::DoPaintPrettyText(hDC, m_pManager, rcText, m_sText, clrText, UICOLOR__INVALID, NULL, nLinks, 0); } // Paint dropdown edit box ::InflateRect(&rcText, -1, -1); if( m_iCurSel >= 0 ) { CUIControl* pControl = static_cast<CUIControl*>(m_items[m_iCurSel]); IListItemUI* pElement = static_cast<IListItemUI*>(pControl->GetInterface(_T("ListItem"))); if( pElement != NULL ) { // Render item with specific draw-style int nLinks = 0; CUIBlueRenderEngine::DoPaintPrettyText(hDC, m_pManager, rcText, pControl->GetText(), UICOLOR_CONTROL_TEXT_NORMAL, UICOLOR__INVALID, NULL, nLinks, DT_SINGLELINE | DT_VCENTER); } else { //// Allow non-listitems to render as well. RECT rcOldPos = pControl->GetPos(); pControl->SetPos(rcText); pControl->DoPaint(hDC, rcText); pControl->SetPos(rcOldPos); } } }