PaintDC problem

Started by
1 comment, last by Faff_Master 23 years, 1 month ago
I''m trying to draw an array of 2D tiles (bitmaps) using Win GDI CPaintDC and CDC. Each tile can draw itself outsite the OnPaint message, but are called from OnPaint(), and are drawn in a loop. The actual blitting does not occur in OnPaint(). I''m using BitBlt() to draw the bitmaps. Only the first tile draws itself, and although the others appear to draw themselves, nothing appears on screen for them. Any ideas?
Advertisement
You may want to use InvalidRect() function, to force a repaint,
But I not sure if it''s going to work.

You can check www.codeguru.com , they have a lot of MFC samples and related stuff.
I don''t really get what you are saying but here''s my version of drawing tile in loop outside OnPaint().

  // assume tile size are 40x40// assume you define CDC tile[number_of_tiles] in CTestView.hvoid CTestView::OnLButtonUp(){    CClientDC this_dc(this);    int       k,x;    for (k=0,x=0; k<number_of_tiles; k++,x+=40) {        this_dc.BitBlt(x,0,40,40,&tile[k],0,0,SRCCOPY);    }}  

This topic is closed to new replies.

Advertisement