Please consider the following code.
__fastcall TMyForm::TMyForm(TComponent* Owner)
: TForm(Owner)
{
Graphics::TBitmap *bmp1;
bmp1 = new Graphics::TBitmap;
bmp1->Width = Screen->Width;
bmp1->Height = Screen->Height;
MyImage->Picture->Bitmap = bmp1;
MyScrollBox->Align = alClient;
maxNDX = 2;
curBmpNDX = 0;
MyImageList->Add(bmp1,NULL);
MyImageList->GetBitmap(0,MyImage->Picture->Bitmap);
If I comment out the last line, all works as I expected, with an image theQuote:}
size of my screen. I have a draw function, executed from a command, so that
each time it is pressed, an ellipse is drawn in a random colour at a random
position with a random size.
The problem is that with the last line active, however, the image is a
square scarcely a third of a centimetre across. Why would TImageList shrink
the bitmap so much?
The autosize property of the TImage component is set to true. I require the
TImage to grow to the size of the bitmap. And when I get to managing a list
of bitmaps (there will be 36, no less, no more), they will all be the same
size.
Would I be better off using an STL vector handled pointers to the bitmaps,
and putting code in the form's destructor to delete the bitmaps?
Are TBitmaps reference counted so I can safely use an assignment like
MyImage->Picture->Bitmap = bmps[i]
And subsequently draw to bmps[i]. And if so, is what I draw shown by the
Image it it's bitmap property is currently set to bmps[i], or do I have to
repeat the assignment? I would suppose the smartest approach is to draw to
the bmps elements before they are shown.
Any suggestions?
Cheers,
Ted
R.E. Byers