Delphi TGridLayout layout and padding between items
delphi, firemonkey, ios
Solution
You were close to an answer yourself, here is how I would achieve this:
Lets say your Grid holds a series of Images with a size of 40 x 40 px
To apply the margin between the images simply set the ItemWidth and ItemHeight properties of the TGridLayout component to a value larger then the size of the actual image, for example 42 x 42 px.
This should create a margin around every Image placed in the TGridLayout.
Problem
I have gotten some results trying to use TGridLayout to hold series of TImage object each with a bitmap loaded. However, there is no margin between the cotrols. I have already tried to make the TImage width/height smaller than TGridLayout itemheight/itemwidth, but no luck. Example code: ``` ImageRef := TImage.Create(GridLayoutGallery); ImageRef.Visible := False; // se true later ImageRef.Width := GridLayoutGallery.ItemWidth - 10; ImageRef.Height := GridLayoutGallery.ItemHeight - 10; GridLayoutGallery.AddObject(ImageRef); ```