gabor via Lazarus
2018-09-19 12:29:16 UTC
Hi.
How to properly create a control with step-size adjustment? I mean a
control whose width is a multiple of, eg. 16 (16,32,48...).
In delphi, I simply override TCustomControl.SetBounds method.
procedure TMyControl.SetBounds(aTop, aLeft, aWidth, aHeight: Integer);
begin
aWidth := (aWidth div 16) * 16;
if aWidth = 0 then
aWidth := 16;
aHeight := (aHeight div 16) * 16;
if aHeight = 0 then
aHeight := 16;
inherited SetBounds(aTop, aLeft, aWidth, aHeight);
end;
Unfortunately, the same does not work well with LCL. Especially in
connection with Anchors or in form designer.
So how to deal with it?
Regards, Michał.
--
How to properly create a control with step-size adjustment? I mean a
control whose width is a multiple of, eg. 16 (16,32,48...).
In delphi, I simply override TCustomControl.SetBounds method.
procedure TMyControl.SetBounds(aTop, aLeft, aWidth, aHeight: Integer);
begin
aWidth := (aWidth div 16) * 16;
if aWidth = 0 then
aWidth := 16;
aHeight := (aHeight div 16) * 16;
if aHeight = 0 then
aHeight := 16;
inherited SetBounds(aTop, aLeft, aWidth, aHeight);
end;
Unfortunately, the same does not work well with LCL. Especially in
connection with Anchors or in form designer.
So how to deal with it?
Regards, Michał.
--