Change the background color of a CDateTimeCtrl

Viewed 153

I have a MFC CDateTimeCtrl object in my MFC based Dialog. My question is, how can I change the background color and the text color of the edit box ?

After an extensive search I tried the following code for a subclassed CDateTimeCtrl but this shows my background color only if I click in the DateTimeCtrl box.

BOOL CCHDateTimeCtrl::OnEraseBkgnd(CDC *pDC)
{
    CRect rect;
    pDC->GetClipBox(&rect);
    pDC->FillSolidRect(&rect, getBackgroundColor());
    return TRUE;
}

Hopefully someone has a suggestion.

0 Answers
Related