Click here to Skip to main content
15,903,523 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralIcon Serialization Pin
smcd16-Jan-05 9:47
smcd16-Jan-05 9:47 
QuestionHow to write an IDE Context Manager Pin
fabiocannizzo16-Jan-05 7:36
fabiocannizzo16-Jan-05 7:36 
AnswerRe: How to write an IDE Context Manager Pin
Roger Allen16-Jan-05 23:27
Roger Allen16-Jan-05 23:27 
GeneralRe: How to write an IDE Context Manager Pin
Anonymous17-Jan-05 5:57
Anonymous17-Jan-05 5:57 
GeneralMoving the caret in a CRichEditCtrl Pin
dlarkin7716-Jan-05 5:22
dlarkin7716-Jan-05 5:22 
GeneralRe: Moving the caret in a CRichEditCtrl Pin
rodgersgb15-Apr-05 16:24
rodgersgb15-Apr-05 16:24 
GeneralChanging Background Color of edit box in VC++ Pin
phijophlip16-Jan-05 2:15
phijophlip16-Jan-05 2:15 
GeneralRe: Changing Background Color of edit box in VC++ Pin
Gary R. Wheeler16-Jan-05 3:40
Gary R. Wheeler16-Jan-05 3:40 
You can change the background color of an edit control in a dialog by handling the WM_CTLCOLOR message in the dialog:
class MyDialog : public CDialog {
//...
    COLORREF _BkgColor;
    HBRUSH   _BkgBrush;
};
BOOL MyDialog::OnInitDialog()
{
//...
    _BkgColor = RGB(0,255,0);
    _BkgBrush = ::CreateSolidBrush(_BkgColor);
}
HBRUSH MyDialog::OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor )
{
    hbr = CDialog::OnCtlColor(pDC,pWnd,nCtlColor);
    if (pWnd()->GetDlgCtrlId() == IDC_MY_EDIT_CONTROL) {
        pDC->SetBkColor(_BkgColor);
        hbr = _BkgBrush;
    }
    return hbr;
}
In the OnInitDialog() handler for the dialog, we initialize the background color value and create a brush in that color. The WM_CTLCOLOR handler is called OnCtlColor. The edit control for which we want to change the color has the resource ID IDC_MY_EDIT_CONTROL. We set the text background to our background color using SetBkColor(), and the overall background for the control by returning the brush we created.


Software Zen: delete this;
QuestionPassword edit control with dots? Pin
Dominik Reichl16-Jan-05 1:06
Dominik Reichl16-Jan-05 1:06 
GeneralMDI problem Pin
KUNGFUMASTA15-Jan-05 21:14
sussKUNGFUMASTA15-Jan-05 21:14 
GeneralRe: MDI problem Pin
KUNGFUMASTA15-Jan-05 21:16
sussKUNGFUMASTA15-Jan-05 21:16 
GeneralRe: MDI problem Pin
nm_11416-Jan-05 17:02
nm_11416-Jan-05 17:02 
GeneralRe: MDI problem Pin
KUNGFUMASTA16-Jan-05 17:46
sussKUNGFUMASTA16-Jan-05 17:46 
Generaldatabase and recordbinding Pin
Anonymous15-Jan-05 18:30
Anonymous15-Jan-05 18:30 
Questionhow to modify the status of objects in richedit control Pin
o0o15-Jan-05 18:07
o0o15-Jan-05 18:07 
GeneralDICOM Pin
Member 78583215-Jan-05 18:00
Member 78583215-Jan-05 18:00 
QuestionHow to change a pixel of a raw image Pin
Adeeler15-Jan-05 16:41
Adeeler15-Jan-05 16:41 
AnswerRe: How to change a pixel of a raw image Pin
Christian Graus16-Jan-05 11:33
protectorChristian Graus16-Jan-05 11:33 
GeneralMultithreading Strategy Qs Pin
KnaveR77715-Jan-05 15:08
KnaveR77715-Jan-05 15:08 
GeneralRe: Multithreading Strategy Qs Pin
Chris Losinger16-Jan-05 4:20
professionalChris Losinger16-Jan-05 4:20 
Generalhookless keylogger part II Pin
Spiritofamerica15-Jan-05 10:34
Spiritofamerica15-Jan-05 10:34 
Generalhookless keylogger part II Pin
Spiritofamerica15-Jan-05 10:32
Spiritofamerica15-Jan-05 10:32 
Generalbstr, wchar_t, and code pages Pin
Samsung15-Jan-05 7:03
Samsung15-Jan-05 7:03 
GeneralRe: bstr, wchar_t, and code pages Pin
Michael Dunn15-Jan-05 10:25
sitebuilderMichael Dunn15-Jan-05 10:25 
GeneralRe: bstr, wchar_t, and code pages Pin
Samsung15-Jan-05 12:18
Samsung15-Jan-05 12:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.