if (event.GetDC())
{
TileBitmap(rect, *(event.GetDC()), m_background);
}
else
{
wxClientDC dc(this);
TileBitmap(rect, dc, m_background);
}
}
else
event.Skip(); // The official way of doing it
}
bool ganjiFrame::TileBitmap(const wxRect& rect, wxDC& dc, wxBitmap& bitmap)
{
int w = bitmap.GetWidth();
int h = bitmap.GetHeight();
int i, j;
for (i = rect.x; i < rect.x + rect.width; i += w)
{
for (j = rect.y; j < rect.y + rect.height; j+= h)
dc.DrawBitmap(bitmap, i, j);
}
return true;
}