{___________________________________________________________________________________________________________________________ CreateControl }
function CreateControl(var ACtrl: TControl; const ACtrlClass: TControlClass; const TheOwner: TControl; const TheParent: TWinControl;
const ALeft, ATop, AWidth, AHeight: Integer): Boolean;
begin
Result := CreateControl(ACtrl, ACtrlClass, TheOwner, TheParent);
ACtrl.Top := ATop ;
ACtrl.Left := ALeft ;
ACtrl.Width := AWidth ;
ACtrl.Height := AHeight;
end; {<--- CreateControl }
{_______________________________________________________________________________________________________________________ SetCtrlAnchorSide }
procedure SetCtrlAnchorSide(const TheCtrl: TControl; const CtrlSide: TAnchorKind; const ACtrl: TControl;
const AnchrMode: TAnchorSideReference; const AMargin: Integer);
begin
if not Assigned(TheCtrl) or not (TheCtrl.Align in [alNone, alCustom]) then begin
Exit;
end;
case CtrlSide of
akTop : begin TheCtrl.BorderSpacing.Top := AMargin; end;
akLeft : begin TheCtrl.BorderSpacing.Left := AMargin; end;
akRight : begin TheCtrl.BorderSpacing.Right := AMargin; end;
akBottom: begin TheCtrl.BorderSpacing.Bottom := AMargin; end;
end; //<--- del case CtrlSide //
TheCtrl.Anchors := TheCtrl.Anchors + [CtrlSide];
TheCtrl.AnchorSide[CtrlSide].Control := ACtrl ;
TheCtrl.AnchorSide[CtrlSide].Side := AnchrMode;
end; {<--- SetCtrlAnchorSide }
{___________________________________________________________________________________________________________________________ SetCtrlLayout }
procedure SetCtrlLayout(const TheCtrl: TControl; const CtrlAlign: TAlign; const MargAround, MargInner: Integer; const TheAnchors: TAnchors;
const TopCtrl: TControl; const TopAnchrMode: TAnchorSideReference; const TopMargin: Integer; const LeftCtrl: TControl;
const LeftAnchrMode: TAnchorSideReference; const LeftMargin: Integer; const BottomCtrl: TControl;
const BottomAnchrMode: TAnchorSideReference; const BottomMargin: Integer; const RightCtrl: TControl;
const RightAnchrMode: TAnchorSideReference; const RightMargin: Integer);
begin
if not Assigned(TheCtrl) then begin
Exit;
end;
TheCtrl.Align := CtrlAlign;
TheCtrl.BorderSpacing.Around := MargAround ;
TheCtrl.BorderSpacing.InnerBorder := MargInner ;
TheCtrl.BorderSpacing.Top := TopMargin ;
TheCtrl.BorderSpacing.Left := LeftMargin ;
TheCtrl.BorderSpacing.Bottom := BottomMargin;
TheCtrl.BorderSpacing.Right := RightMargin ;
if not (TheCtrl.Align in [alNone, alCustom]) then begin//TheCtrl.Align <> alNone then begin
Exit;
end;
TheCtrl.Anchors := TheAnchors;
TheCtrl.AnchorSide[akTop ].Control := TopCtrl ;
TheCtrl.AnchorSide[akTop ].Side := TopAnchrMode ;
TheCtrl.AnchorSide[akLeft ].Control := LeftCtrl ;
TheCtrl.AnchorSide[akLeft ].Side := LeftAnchrMode ;
TheCtrl.AnchorSide[akBottom].Control := BottomCtrl ;
TheCtrl.AnchorSide[akBottom].Side := BottomAnchrMode;
TheCtrl.AnchorSide[akRight ].Control := RightCtrl ;
TheCtrl.AnchorSide[akRight ].Side := RightAnchrMode ;
end; {<--- SetCtrlLayout }