1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| HBRUSH EOBD_MODE5::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
CBrush Temp;
CBitmap BTemp;
CPoint m_pts;
RECT m_rect;
// Are we painting the IDC_MYSTATIC control? We can use
// CWnd::GetDlgCtrlID() to perform the most efficient test.
//si c des controles qui nous interressent:
if ( (nCtlColor == CTLCOLOR_BTN)|(nCtlColor == CTLCOLOR_LISTBOX))|(nCtlColor == CTLCOLOR_STATIC))
{
// Set the text color to red.
pDC->SetTextColor(RGB(255, 0, 0));
// Set the background mode for text to transparent
// so background will show thru.
pDC->SetBkMode(TRANSPARENT);
// Return handle to our CBrush object.
//on recupere la position du controle
pWnd->GetWindowRect( &m_rect );
//on recuper le bord haut gauche
if ( nCtlColor != CTLCOLOR_BTN )
m_pts.x = -m_rect.left-1;
else
m_pts.x = -m_rect.left;
m_pts.y = -m_rect.top+25;//+25 => c'est la barre de menu!
//on change la position du pinceaux pour reprendre l'image au bon endroit
pDC->SetBrushOrg(m_pts);
//on affecte la position du pinceau au controle.
hbr = m_brush;
}
// TODO: Return a different brush if the default is not desired
return hbr;
} |
Partager