Deleting DFM data for garbage from TImage32 (Graphics32 library)

I have a control derived from TImage32:

TChromaDisplay = class(TImage32)

Everything is fine, except that when I drop my TChromaDisplay on the form, the resulting DFM file is huge (300 KB instead of <1 KB) because I have garbage data (this is just a gray image) stored in the Bitmap.Data field . A bitmap image is created and grayed out every time I delete a control on a form. I do not want to save the image content (garbage) to a DFM file, since it makes the EXE bigger, but I do not know how to do it.

Maybe I need to write somewhere in TChromaDisplay.Create that I don't have image data saved / saved in my TChromaDisplay. But I don’t know where and how to do it.

  object Display: TChromaDisplay
    Left = 0
    Top = 0
    Width = 1465
    Height = 246
    Bitmap.Data = {
      C0000000C0000000EBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFF
      EBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFF
      EBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFFEBEBEBFF
      etc
      etc
      etc

Create, :

Bitmap.Width := 1;
Bitmap.Height:= 1;
+5
2

Update:

GR32_Dsgn_Bitmap.pas TImage32.Bitmap, Clear Bitmap.Delete, 0x0. , :

type
  TChromaDisplay = class(TImage32)
  protected
    procedure WriteState(Writer: TWriter); override;
  end;

implementation

procedure TChromaDisplay.WriteState(Writer: TWriter);
begin
  Bitmap.Delete;
  inherited;
end;

- , , . Bitmap.Delete , ( Bitmap ).

, .

+3

"". ( , , ). , 0, 0 1465, 246.

BitmapData - ( ..), , dfm.

, , . :

  • ( ?)
  • ( IDE)
  • DFM , .

, , , . , (, FBitmap FImage), , (LoadFromFile, LoadFromStream, LoadFromResource, Assign ..).

: dfm . . , . View as Text. TChromaDisplay ( TChroma) , dfm. chaose View as Form, . dfm , TChroma - .

+2

All Articles