Catalin80
asked on
Timage descendent - designtime painting
My component has to paint some rectangles on itself's canvas, according to some parameters.
How can my component show the rectangles even at designtime ? (like all vcl components in delphi : when you place/resize/etc the component on the form, you _see_ it , not only the contour.
How can my component show the rectangles even at designtime ? (like all vcl components in delphi : when you place/resize/etc the component on the form, you _see_ it , not only the contour.
ASKER
If it works, give me the sample code. Thx.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
?? There's no difference. At design time Delphi runs your code, just like at run time. If you component view OK at runtime, it should work at design time, too.
(Obviously non-visual controls don't display, but then you can't see them at runtime either)
(Obviously non-visual controls don't display, but then you can't see them at runtime either)
ASKER
@DeerBear : That works fine but : when the strech property is false, the object blinks.
Hi,
Use double buffering to avoid flickering.
Draw your image on a temporary bitmap and then transfer it on the
drawing surface.
HTH,
Andrew
Use double buffering to avoid flickering.
Draw your image on a temporary bitmap and then transfer it on the
drawing surface.
HTH,
Andrew
... or one of the vcl base classes has a 'DoubleBuffered' property, and it does it all for you.
Why do you use TImage as base class?
Wouldn't a TPaintBox have been better?
Anyway, the only "pictures" you can see at design time are
loaded files, which get displayed in the "Paint" method or the
Update one, I didn't look at the sources.
So, my guess is that you should look in the TImage class where
this happens and act accordingly.
HTH,
Andrew
P.S. As a last chance, you can always override the WM_PAINT method.
If you want a sample just let me know.