Form Background color change - Reg.
-
Hi.. In CView application I am showing a dialog(Like toolbar/ Status bar). I have to change the dialog background color. I used the following code. But background color not changing. If i use this same in new dialog application the background color is changing.
ON_WM_ERASEBKGND()
BOOL CTech::OnEraseBkgnd(CDC* pDC)
{
CRect rect; GetClientRect(&rect);
CBrush myBrush(RGB(255, 0, 255));
// dialog background color
CBrush *pOld = pDC->SelectObject(&myBrush);
BOOL bRes = pDC->PatBlt(0, 0, rect.Width(), rect.Height(), PATCOPY);
pDC->SelectObject(pOld);
// restore old brush
return bRes;
}How to solve this problem. Any help will be appriciated.. Thanks...
G.Paulraj
-
Hi.. In CView application I am showing a dialog(Like toolbar/ Status bar). I have to change the dialog background color. I used the following code. But background color not changing. If i use this same in new dialog application the background color is changing.
ON_WM_ERASEBKGND()
BOOL CTech::OnEraseBkgnd(CDC* pDC)
{
CRect rect; GetClientRect(&rect);
CBrush myBrush(RGB(255, 0, 255));
// dialog background color
CBrush *pOld = pDC->SelectObject(&myBrush);
BOOL bRes = pDC->PatBlt(0, 0, rect.Width(), rect.Height(), PATCOPY);
pDC->SelectObject(pOld);
// restore old brush
return bRes;
}How to solve this problem. Any help will be appriciated.. Thanks...
G.Paulraj
-
I do not think that this is the message for the dialog's background repaint. Take a look at the WM_CTLCOLORDLG[^] notification.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
-
Paulraj G wrote:
It is working fine in form based applications...
What has that to do with a Dialog? Did you follow the link I posted, and try using the methods suggested by Microsoft?
txtspeak is the realm of 9 year old children, not developers. Christian Graus