BitmapsThe functions available to handle bitmaps in cells are:
function CreateBitmap(ACol,ARow: Integer;transparent:Boolean;hal:TCellHalign;val:TCellValign):TBitmap;
procedure AddBitmap(ACol,ARow: Integer;ABmp:TBitmap;Transparent:Boolean;hal:TCellHalign;val:TCellValign);
procedure RemoveBitmap(ACol,ARow: Integer);
function GetBitmap(ACol,ARow: Integer):TBitmap;
The difference between CreateBitmap and AddBitmap is that with CreateBitmap, the bitmap
instance is created, maintained and destroyed by the grid while with AddBitmap it is the
responsibility of the programmer to create the instance and destroy it.
In code this difference becomes clear:
// add bitmap from resource to the grid
Grid.CreateBitmap(2,3,True,haBeforeText,vaTop).LoadFromResourceName(HInstance,’TEST’);
var
Bmp: TBitmap;
Bmp := TBitmap.Create;
Bmp.LoadFromResourceName(HInstance,’TEST’);
Grid.AddBitmap(2,3,True,haBeforeText,vaTop);
// at the end of the application, the bitmap needs to be destroyed
Bmp.Free;
PicturesAdding pictures is very similar to adding bitmaps to a cell. The CreatePicture and AddPicture are
available to add a picture that is either created, maintained and destroyed by the grid or a picture
that is created, maintained and destroyed by the application.