<p style="padding:0 0 0 0; margin:0 0 0 0;">Try set Constraints - set MinHeight=MaxHeight=your calculated height, and the same for Width.</p>

<p style="padding:0 0 0 0; margin:0 0 0 0;">But it will maybe fool Lazarus autosizing mechanism.</p>

<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>

<p style="padding:0 0 0 0; margin:0 0 0 0;">V.</p>

<p style="padding:0 0 0 0; margin:0 0 0 0;">______________________________________________________________<br />
> Od: "gabor via Lazarus" <lazarus@lists.lazarus-ide.org><br />
> Komu: lazarus@lists.lazarus-ide.org<br />
> Datum: 19.09.2018 14:29<br />
> Předmět: [Lazarus] Custom control with stepwise size adjustment<br />
></p>

Hi.<br />
 How to properly create a control with step-size adjustment? I mean a <br />
 control whose width is a multiple of, eg. 16 (16,32,48...).<br />
 In delphi, I simply override TCustomControl.SetBounds method.<br />
 <br />
 procedure TMyControl.SetBounds(aTop, aLeft, aWidth, aHeight: Integer);<br />
 begin<br />
   aWidth := (aWidth div 16) * 16;<br />
   if aWidth = 0 then<br />
     aWidth := 16;<br />
   aHeight := (aHeight div 16) * 16;<br />
   if aHeight = 0 then<br />
     aHeight := 16;<br />
   inherited SetBounds(aTop, aLeft, aWidth, aHeight);<br />
 end;<br />
 <br />
 Unfortunately, the same does not work well with LCL. Especially in <br />
 connection with Anchors or in form designer.<br />
 So how to deal with it?<br />
 <br />
 Regards, Michał.<br />
 -- <br />
 _______________________________________________<br />
 Lazarus mailing list<br />
 Lazarus@lists.lazarus-ide.org<br />
 <a href="https://lists.lazarus-ide.org/listinfo/lazarus">https://lists.lazarus-ide.org/listinfo/lazarus</a><br />