[Lazarus] Centered elements in autosize enabled panel. Possible?
Valdas Jankūnas
zmuogs at gmail.com
Sun Nov 10 21:43:31 CET 2013
2013.11.10 18:24, William Oliveira Ferreira rašė:
> I think you could also use anchors
Anchors not helps if Parent.Autosize is True.
I found better solution:
- Panel.AutoSize := True;
- Panel.ChildSizing.ControlsPerLine := MaxInt;
- Panel.ChildSizing.Layout := cclLeftToRightThenTopToBottom;
- Every Child.BorderSpacing.Left := 2;
- Every Child.BorderSpacing.CellAlignVertical := ccaCenter;
- Every Child.AutoSize := True;
If you want to adjust Child's Width (by default you cannot) then you
must use overridden procedure "CalculatePreferredSize" in class of that
Child, in which:
inherited CalculatePreferredSize(PreferredWidth, PreferredHeight,
WithThemeSpace);
PreferredWidth := Width;
--
Valdas Jankūnas
More information about the Lazarus
mailing list