I'd like to redraw Client area of the wxMDIClientWindow with bitmap this way
Code: Select all
void MainWnd::OnPaint(wxPaintEvent& event)
{
wxMDIClientWindow* cwindow = this->wxMDIParentFrame::GetClientWindow();
wxPaintDC dc(cwindow);
int vX,vY,vW,vH; // Dimensions of client area in pixels
/*ver1*/ wxRegionIterator upd(GetUpdateRegion());
/*ver2*/ wxRegionIterator upd(cwindow->GetUpdateRegion());
while (upd)
{
vX = upd.GetX();
vY = upd.GetY();
vW = upd.GetW();
vH = upd.GetH();
dc.SetClippingRegion(vX,vY,vW,vH);
int xs = (vX/logo->GetWidth())*logo->GetWidth();
int ys = (vY/logo->GetHeight())*logo->GetHeight();
int w = (vW / logo->GetWidth())+1 ;
int h = (vH / logo->GetHeight())+1 ;
for(int a=0;a<w;a++){
for(int b=0;b<h;b++){
dc.DrawBitmap(*logo,xs+(a*logo->GetWidth()),ys+(b*logo->GetHeight()));
}
}
upd ++ ;
}
}
Code: Select all
EVT_PAINT(MainWnd::OnPaint)
In code with "ver2" remark I get no rectangles to update at all :/
I must made a stupid mistake. I'm very fresh with wxWidgets...
Any help ? I can't go with "ver1" since it's doing whole lot of redraws and is kill my application performance.
Thanks !