reuse resource image bitmap instead of duplicate them in xfm files

346 views Asked by At

I have several TBitBtns in several different forms of a Delphi 7 CLX application that make use of some images as Glyph (TBitMap), now the problem is that though the images are the same, each time I load the TBitMap as Glyph property of the TBitButton(from the designer tool) the image is loaded on the form xfm file and the size of the final executable bloat ...

Since I use the same image for different buttons in different forms, what's the best way to share the image ? A resource file ?

How can I avoid to bloat the final executable size ?

1

There are 1 answers

0
nullptr On BEST ANSWER

I'd recommend adding a DataModule into the project. At the DataModule, you can create an TImageList and fill it with images. Most visual components allow loading glyphs from ImageLists, and you can easily specify a glyph from DataModule's ImageList in design-time.