Bonjour,
J'ai suivi le FAQ pour changer la couleur de mon controle CEdit.
J'ai deux mode sur mon controle Alert (couleur rouge) et Valide (couleur verte) mais je voudrait pouvoir revenir à la couleur par default du controle si je revoie NULL sa crache en release.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 HBRUSH CCustomMaskEdit::CtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = NULL; // TODO: Change any attributes of the DC here if ( !IsReadOnly() ) { if ( m_bAlert ) { pDC->SetTextColor(m_TextColor); pDC->SetBkColor(m_RedColor); hbr = (HBRUSH) m_brushRed; } if ( m_bValid ) { pDC->SetTextColor(m_TextColor); pDC->SetBkColor(m_GreenColor); hbr = (HBRUSH) m_brushGreen; } } // TODO: Return a non-NULL brush if the parent's handler should not be called return hbr; }
Partager