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 

Storing Bitmaps

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
John Runyan
Guest





PostPosted: Wed Jul 07, 2004 10:23 pm    Post subject: Storing Bitmaps Reply with quote



I have a bitmap in the RES file for my component. I load the bitmap with
the following code:

if ( this->ComponentState.Contains(csDesigning) )
this->FScrollDown->Glyph->LoadFromResourceName((int)HInstance,
"SCROLLDOWN");

I needed the if csDesigning because at design time the HInstatnce refers to
the res of the component. At runtime this causes an error "Resource
"SCOLLDOWN" not found"

I expected the bitmap to be streamed for me but that didn't work. At
runtime there is no bitmap.

Where do I save the bitmap to? Where do I locate the code?

Thanks.


--
John Runyan


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed Jul 07, 2004 10:53 pm    Post subject: Re: Storing Bitmaps Reply with quote




"John Runyan" <jrunyan (AT) necassociates (DOT) com> wrote


Quote:
I needed the if csDesigning because at design time the
HInstatnce refers to the res of the component. At runtime
this causes an error "Resource "SCOLLDOWN" not found"

You are using the wrong HInstance value when calling LoadFromResourceName().
You need to use the FindClassHInstance() function instead, ie:


FScrollDown->Glyph->LoadFromResourceName(FindClassHInstance(__classid(TMyCom
ponent)), "SCROLLDOWN");

This way, you also don't need to check the csDesigning flag at all, either.


Gambit



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) 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.