DELPHI AREA
MESSAGE BOARD
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   FavoritesFavorites   Watched TopicsWatched Topics     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

a visual component creation question..

 
Post new topic   Reply to topic   printer-friendly view    DELPHI AREA Forum Index -> Delphi Programming
View previous topic :: View next topic  
Author Message
very angry mobster
Member


Joined: 27 Jul 2006
Posts: 3

PostPosted: 03/08/06 11:01    Post subject: a visual component creation question.. Reply with quote

Hi all,

I'm starting to program visual components for use in delphi and i've run into a small problem. From what i understand, when drawing the graphics for a control, i should render the graphics on an off-screen bitmap then copy the result to the on-screen control.

my question is, where do i create the off screen bitmap?

my first thought was to create the temp bitmap in the components constructor, but at that stage the components size still has not been set. i then tried to override the width and height properties so that i could change the size of my bitmap when width and height were changed, but that didn't seem to work at all. Is it possible to override a property declared in a components base class?

should the temp bitmap be created at the beginning of the Paint procedure?


cheers,
vam
Back to top
View user's profile Send private message
Johnny_Bit
Moderator


Joined: 15 Jun 2003
Posts: 274

PostPosted: 03/08/06 12:38    Post subject: Reply with quote

Look at already done components and try to learn from them, it's the easiest way... another way is getting some books.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1044
Location: Tehran, Iran

PostPosted: 04/08/06 10:00    Post subject: Reply with quote

Create and destroy the off screen bitmap respectfully in cobstructor and destructor of the component.

If the base control has Resize method, you can override Resize method to set the size of bitmap.

TGraphicControl im older versions of Delphi doesn't have Resize method, therefore you have to set size of the bitmap before drawing on it.

_________________
Kambiz
Back to top
View user's profile Send private message Send e-mail Visit poster's website
very angry mobster
Member


Joined: 27 Jul 2006
Posts: 3

PostPosted: 04/08/06 11:50    Post subject: Reply with quote

Thanks Johnny and Kambiz.

I only have a few gui components installed. namely the DIB Components by peter morris, which seem to draw straight onto the components canvas. which i thought was a no-no anyway as it can contribute to image flicker. i haven't followed the logic though to the base classes so perhaps i'm wrong about that.


cheers,
vam
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    DELPHI AREA Forum Index -> Delphi Programming All times are GMT
Page 1 of 1

Add to favorites

 
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
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group