Index: VerpakkingsDefinitie/UI/Util.pas =================================================================== diff -u -r559 -r569 --- VerpakkingsDefinitie/UI/Util.pas (.../Util.pas) (revision 559) +++ VerpakkingsDefinitie/UI/Util.pas (.../Util.pas) (revision 569) @@ -7,20 +7,37 @@ System.Types, Vcl.Graphics; // Color lightener type - TUtilControls = class + TUtil = class + class procedure VervangControl(OudeControl: TControl; NieuweControl: TControl); class procedure FreeControlChildrenRec(AControl: TControl); - end; - - TUtilColorLightener = class class function LightenColor(RGB: Cardinal; Percentage: Integer): Cardinal; static; end; implementation +// VERVANG CONTROL +class procedure TUtil.VervangControl(OudeControl: TControl; NieuweControl: TControl); +begin + // Positie + NieuweControl.Left := OudeControl.Left; + NieuweControl.Top := OudeControl.Top; + NieuweControl.Anchors := OudeControl.Anchors; + // Dimensies + NieuweControl.Width := OudeControl.Width; + NieuweControl.Height := OudeControl.Height; + // Properties + NieuweControl.parent := OudeControl.parent; + NieuweControl.Enabled := OudeControl.Enabled; + NieuweControl.visible := OudeControl.visible; + + // Oude control verbergen + OudeControl.visible := False; +end; + // FREE CONTROL CHILDREN // Recursieve methode om de kinderen van een TWinControl te free-en (hanging pointers voorkomen) // Gebaseerd op: https://stackoverflow.com/questions/414928/is-there-any-way-to-get-all-the-controls-on-a-container-control -class procedure TUtilControls.FreeControlChildrenRec(AControl: TControl); +class procedure TUtil.FreeControlChildrenRec(AControl: TControl); var item: TControl; i: Integer; @@ -204,7 +221,7 @@ Result := RGB(RoundColor(R), RoundColor(G), RoundColor(B)); end; -class function TUtilColorLightener.LightenColor(RGB: Cardinal; Percentage: Integer): Cardinal; +class function TUtil.LightenColor(RGB: Cardinal; Percentage: Integer): Cardinal; var H, S, L: Word; begin