BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

double buffer problem

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
LarryJ
Guest





PostPosted: Wed Jan 05, 2005 4:04 am    Post subject: double buffer problem Reply with quote



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





PostPosted: Wed Jan 05, 2005 9:36 pm    Post subject: Re: double buffer problem Reply with quote




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





PostPosted: Thu Jan 06, 2005 9:28 pm    Post subject: Re: double buffer problem Reply with 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?

" 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





PostPosted: Thu Jan 06, 2005 9:44 pm    Post subject: Re: double buffer problem Reply with quote


"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.