I have started new SDI MFC application (CScroolView). I want to change the color of mainframe, I got one solution for that by doing
1. Added ON_WN_NCPAINT in message handler
2. Added “afx_msg void OnNcPaint( );” in MainFrm.h
3. I overtraded the function in MainFrm.cpp as follows
CDC* pWinDC = GetWindowDC();
CRect rect;
GetWindowRect(&rect);
ScreenToClient(&rect);
CRect rectClient;
GetClientRect(&rectClient);
rectClient.OffsetRect(-rect.left, -rect.top);
rect.OffsetRect(-rect.left, -rect.top);
pWinDC->ExcludeClipRect(&rectClient);
CBrush backBrush(RGB(255,255,255));
CBrush* pOldBrush = pWinDC->SelectObject(&backBrush);
pWinDC->SelectObject(pOldBrush);
pWinDC->SelectClipRgn(NULL);
ReleaseDC(pWinDC);
So it changed the main frame color.
But after this I got the problem............
1) If I want to change the color of main frame to any other color by changing RGB values in the above code it’s not happening...........???????????
2) Even if I comment all code also no change.....(Previously colored frame is coming)
If I comment ON_WN_NCPAINT then it’s giving default mainframe (Microsoft providing)
So what is happening I am not getting at all ………………………………….
Because we will write ON_WN_NCPAINT in message handler to execute OnNcPaint( ) function even though I haven’t written any code inside this how it’s coming as previously painted mainframe is coming...........
Please help me what is happening inside this.........
Thanks for having patience in reading my problem if possible please give me suggestion to solve/ understand the problem.....................