I have a control derived from TImage32:
TChromaDisplay = class(TImage32)
Everything is fine except that when I drop my TChromaDisplay on the form, the resulted DFM file is huge (300KB instead of <1KB) because I have garbage data (it is just a gray image) saved in the Bitmap.Data field. The Bitmap image is created and filled with gray color every time I drop my control on a form. I don’t want to save the content of the image (garbage) to the DFM file since it makes the EXE larger but I don’t know how.
Probably I need to write somewhere in TChromaDisplay.Create that I don’t have any image data saved/stored in my TChromaDisplay. But I don’t know where/how to do it.
object Display: TChromaDisplay
Left = 0
Top = 0
Width = 1465
Height = 246
Bitmap.Data = {
C0000000C0000000EBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFF
EBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFF
EBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFF
etc
etc
etc
I have tried this in Create but won’t help:
Bitmap.Width := 1;
Bitmap.Height:= 1;
Update:
Looking at design time image dialog
GR32_Dsgn_Bitmap.pasforTImage32.Bitmapproperty, theClearbutton there uses theBitmap.Deleteprocedure what just sets the bitmap size to 0x0. So you can try to call it to clear the bitmap before the form stream is saved:But it still doesn’t explain why you have a bitmap data when you put a control on the form. You can also call the
Bitmap.Deletein your control constructor after inherited part is done (when theBitmapis already instantiated).Still untested, since I can’t simulate your problem.