Board index » cppbuilder » double buffer problem

double buffer problem


2005-01-05 12:04:25 PM
cppbuilder101
I am using a paintbox for my front viewable screen and a bitmap for the
invisible back buffer. The code below creates the buffer. This is all being
done on child forms which can be resized, but the HBITMAP can not be
resized. So if the child form changes size I must delete the Bitmap and
create a new one. Is there any way I can avoid deleting and creating a new
bitmap each time the child form resizes? I would like to create the back
buffer once when the child form is created. Is there any way to do that?
TCanvas *BGCanvas;
HDC hDC_BG;
HBITMAP hBMP_BG;
hDC_BG = CreateCompatibleDC(Canvas->Handle);
hBMP_BG = CreateCompatibleBitmap(Canvas->Handle, ClientWidth, ClientHeight);
SelectObject(hDC_BG, hBMP_BG);
BGCanvas->Handle = hDC_BG;
Thanks
Larry
 
 

Re:double buffer problem

Quote
So if the child form changes size I must delete the Bitmap and
create a new one. Is there any way I can avoid deleting and creating
a new bitmap each time the child form resizes? I would like to
create the back buffer once when the child form is created. Is there
any way to do that?
What's wrong with generating a new bitmap when the form is resized?
 

Re:double buffer problem

Do you know what x y values I would use to create a bitmap which is the full
size of the screen? That might work for me. Is there an API to get these x y
values?
" Bruce Salzman" < XXXX@XXXXX.COM >wrote in message
Quote


What's wrong with generating a new bitmap when the form is resized?

--
Bruce

 

{smallsort}

Re:double buffer problem

"LarryJ" < XXXX@XXXXX.COM >wrote in message
Quote
Do you know what x y values I would use to create a bitmap which is
the full size of the screen? That might work for me. Is there an API
to get these x y values?
You can use the WinAPI GetDeviceCaps() to get the size of the physical
screen or the virtual desktop size. You might also consider using a
small bitmap and tiling it to fill your form.
Regards,
Bruce