| View previous topic :: View next topic |
| Author |
Message |
LarryJ Guest
|
Posted: Wed Jan 05, 2005 4:04 am Post subject: double buffer problem |
|
|
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
|
|
| Back to top |
|
 |
Bruce Salzman Guest
|
Posted: Wed Jan 05, 2005 9:36 pm Post subject: 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?
--
Bruce
|
|
| Back to top |
|
 |
LarryJ Guest
|
Posted: Thu Jan 06, 2005 9:28 pm Post subject: 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" <bruce (AT) nospam (DOT) org> wrote
| Quote: |
What's wrong with generating a new bitmap when the form is resized?
--
Bruce
|
|
|
| Back to top |
|
 |
Bruce Salzman Guest
|
Posted: Thu Jan 06, 2005 9:44 pm Post subject: Re: double buffer problem |
|
|
"LarryJ" <LarryJ33 (AT) ev1 (DOT) net> wrote
| 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
|
|
| Back to top |
|
 |
|