MGR: When erasing controls in Simple Preferences dialog, align background image correctly for controls that are descendants of the dialog deeper than one level (grandchild, great-grandchild, etc.)

This commit is contained in:
Charlie Fenton 2015-03-28 04:09:34 -07:00
parent 4f0fadc34c
commit 47bd5c0685
1 changed files with 16 additions and 4 deletions

View File

@ -180,8 +180,14 @@ void CTransparentHyperlinkCtrl::OnEraseBackground(wxEraseEvent& event)
wxMemoryDC memDC(**m_pParentsBgBmp);
wxSize sz = GetClientSize();
wxDC *dc = event.GetDC();
wxCoord x, y;
GetPosition(&x, &y);
wxCoord x=0, y=0, xx, yy;
wxWindow* win = this;
do {
win->GetPosition(&xx, &yy);
x += xx;
y += yy;
win = win->GetParent();
} while (!win->IsTopLevel());
dc->Blit(0, 0, sz.GetWidth(), sz.GetHeight(), &memDC, x, y, wxCOPY);
} else {
event.Skip();
@ -365,8 +371,14 @@ void CTransparentCheckBox::OnEraseBackground(wxEraseEvent& event)
wxMemoryDC memDC(**m_pParentsBgBmp);
wxSize sz = GetClientSize();
wxDC *dc = event.GetDC();
wxCoord x, y;
GetPosition(&x, &y);
wxCoord x=0, y=0, xx, yy;
wxWindow* win = this;
do {
win->GetPosition(&xx, &yy);
x += xx;
y += yy;
win = win->GetParent();
} while (!win->IsTopLevel());
dc->Blit(0, 0, sz.GetWidth(), sz.GetHeight(), &memDC, x, y, wxCOPY);
} else {
event.Skip();