Board index » Visual Studio » Painting the background of my control the same colour as my owner
|
breathwell
|
Painting the background of my control the same colour as my owner
Visual Studio305
Hi, whats the best way of painting the background of my child window the same as my parent window? Im using a tab control and have a dialog placed over it, but when i use XP styles, the dialog is grey, but the tab background is white, so i want them to match. (See your graphics options - right click desktop ->properties, for a comparison of the tab control). Ive tried the following 2 pieces of code in OnEraseBkgnd() CDC* pParentDC = m_pParentWnd->GetDC(); COLORREF crBack = pParentDC->GetBkColor(); CRect rctArea; this->GetClientRect(&rctArea); pDC->FillSolidRect(&rctArea, crBack); and CDC* pParentDC = m_pParentWnd->GetDC(); CBrush* pBrush = pParentDC->GetCurrentBrush(); CRect rctArea; this->GetClientRect(&rctArea); pDC->FillRect(rctArea, pBrush); Which works ok, ie with no xp style, theyre grey, with XP style they are white. But the tab background isnt actual white, its slightly off white, so you can still see a border, so i presume i dont have the correct colours loaded (ie, theyre reset when not in the middle of the parent controls paint method). Can anyone shed some light onto getting the dialogs the same colour please? Cheers Mark - |
