Autor Beitrag
csigg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 706

WIn XP, Win NT, Win2000, Suse8.0
Delphi 5, Delphi 6
BeitragVerfasst: Di 12.04.05 09:14 
Wie kann ich ein Label ausrichten??
Ich habe ein weiteres Label(2), und würde gerne das (1) an (2) ausrichten. Das zweite wird im Programm korrekt posiotioniert. Jetzt würde ich gern (1) das linke untere Eck z.B. an (2) ausrichten.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 12.04.05 09:33 
Meinst du das?
ausblenden Delphi-Quelltext
1:
2:
Label1.Left := Label2.Left + Label2.Width;
Label1.Top := Label2.Top + Label2.Height;
csigg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 706

WIn XP, Win NT, Win2000, Suse8.0
Delphi 5, Delphi 6
BeitragVerfasst: Di 12.04.05 09:40 
jap, das hab ich gesucht.
csigg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 706

WIn XP, Win NT, Win2000, Suse8.0
Delphi 5, Delphi 6
BeitragVerfasst: Di 12.04.05 09:44 
bei mir wird die Position aber nicht wirklich verändert, was müssen da für attribute gesetzt sein??
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 12.04.05 09:49 
Wenn man alles auf Standard-Voreinstellung hat, funktioniert das einwandfrei. Zumindest bei mir. :wink:
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 12.04.05 09:51 
Gar keine Attribute...
Die Frage ist nur, wo du das benutzt hast?

Ich würde es in onResize machen, falls die Position des anderen Labels dynamisch verändert wird, ansonsten in onCreate.
(Beide Ereignisse vom Formular)

Abgesehen davon: Wodurch verändert sich eigentlich die Position des Labels, an dem der andere ausgerichtet werden soll? Ich nehme mal an, dass da auch eine dieser beiden Möglichkeiten benutzt wird?

Und dann noch ein Hinweis:
Soll der Label exakt beispielsweise der rechten Seite des Formulars folgen, wenn dessen Größe verändert wird, gibt es auch noch die Eigenschaft Anchors (jedenfalls in neueren Delphi-Versionen), womit dies sehr einfach ohne weiteren Quelltext funktioniert.
csigg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 706

WIn XP, Win NT, Win2000, Suse8.0
Delphi 5, Delphi 6
BeitragVerfasst: Do 14.04.05 14:18 
hat sich erledigt, danke