void CButtonST::DrawTheIcon(CDCHandle pDC, bool bHasTitle, RECT &rpItem, CRect &rpTitle, bool bIsPressed, bool bIsDisabled) { BYTE byIndex = 0; // Select the icon to use if (bIsDisabled) { byIndex = (m_csIcons[2].hIcon == NULL ? 0 : 2); } else if (m_bIsCheckBox) { if (bIsPressed) { byIndex = 0; } else { byIndex = (m_csIcons[1].hIcon == NULL ? 0 : 1); } } else { if (m_bMouseOnButton || bIsPressed) { byIndex = 0; } else { byIndex = (m_csIcons[1].hIcon == NULL ? 0 : 1); } } CRect rImage; PrepareImageRect(bHasTitle, rpItem, rpTitle, bIsPressed, m_csIcons[byIndex].dwWidth, m_csIcons[byIndex].dwHeight, rImage); // Ole'! pDC.DrawState( rImage.TopLeft(), rImage.Size(), m_csIcons[byIndex].hIcon, /*(bIsDisabled ? DSS_DISABLED :*/ DSS_NORMAL, 0); }