Component - Design Time Great...Run-Time Not...Help
Here's the scenario...
I've got a TDevice component. At design time I load in a
bitmap. It is stored in bmpBG. During Paint events, this
bmpBG is transferred to bmpBuffer. I then do some drawing
on the buffer. Then I finally transfer bmpBuffer to the
component canvas. Great. This all works fine at design-time.
But when I run the project, the component is empty. I'm
figuring it is because, since the bitmap I loaded is
now part of the EXE, the SetBGBmp function that ran when
it was loaded at design-time (which set the width and height
of bmpBuffer to bmpBG) does not execute now. Therefore,
bmpBuffer now has a Width and Height of 0. I'm
guessing that bmpBG is just fine. How and where should I
set bmpBuffer when the programs runs? I've tried it in the
Create method, after creating memory for bmpBG and bmpBuffer,
but this doesn't work. I read something about OnChange events,
but I'm not sure that this is relevant and I'm not sure exactly
how this works.
Can anyone give me a hand?
I've enclosed the Zipped source for this component below.
It's only 10KB, so hopefully no one will mind this little
indiscretion. If I'd just cut-and-pasted the code here,
it would have taken more space than the zip file.
--
Michael Heacock "Hail hail the lucky ones,
Praxis Technical Group I refer to those in love"
Nanaimo BC Canada -- Eddie Vedder