Topic: Setting Anchors by code.
I've hijacked the login form to place my own image and text. The code below works.
begin
CentreForm(frmMain);
lbAcknowledge := TLabel.Create(frmdbCoreLogin);
lbAcknowledge.Left := 113;
lbAcknowledge.Top := 170;
lbAcknowledge.Width := 300;
lbAcknowledge.Height:= 15;
lbAcknowledge.Parent := frmdbCoreLogin;
lbAcknowledge.Wordwrap := true;
lbAcknowledge.Caption := 'image copyright free from unsplash.com/photos/jXd2FSvcRr8';
lbAcknowledge.Visible := True;
frmdbCoreLogin.Caption := 'Workshop Parts Login';
{logo is copyright free from https://unsplash.com/photos/jXd2FSvcRr8 }
frmdbCoreLogin.Image1.Picture.loadfromfile((ExtractFilePath(Application.ExeName)+ 'WOS_login.jpg'));
end.
However with screens that have a different resolution the label moves too far from the logo and becomes obscured by the User log in box.
I have tried to use anchors, but I get errors as follows.
lbAcknowledge.Anchors := [akTop, akLeft, akRight];
I get an error "Initialization section......... Could not convert variant into an integer".
If I try
lbAcknowledge.Anchors := [TAnchors.akLeft, TAnchors.akTop];
My error becomes "cannot form an array".
Any thoughts out there on how to set anchors in the 'initialization' section of the script?