Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Label mit hartem Bruch (https://www.delphipraxis.net/8723-label-mit-hartem-bruch.html)

nailor 10. Sep 2003 19:37


Label mit hartem Bruch
 
Ich will ein Label mit Zeilenumbruch, aber nicht so wie bei WordWrap, bei Leerzeichen ein Umbruch, sondern egal was da ist.

Ronny Grabo 10. Sep 2003 19:42

Re: Label mit hartem Bruch
 
Hallo,
folgender Vorschlag:
Delphi-Quellcode:
label1.caption:='So funktioniert'+chr(13)+'es';
chr(13)=Zeilenumbruch

nailor 10. Sep 2003 19:52

Re: Label mit hartem Bruch
 
ich weiß aber nicht wohin der umbruch muss

Ronny Grabo 10. Sep 2003 20:20

Re: Label mit hartem Bruch
 
Hallo,

folgender Vorschlag:
Delphi-Quellcode:
procedure TForm1.Label1Click(Sender: TObject);
var tmp0:String;
    tmpint:integer;
begin
//String zuweisen
tmp0:='Das ist mein Label';
{Stringlänge von tmp0 ermitteln und durch zwei rechnen
anschließend runden und Ergebnis an tmpint als Integer übergeben.} 
tmpint:=round(strlen(PChar(tmp0))/2);
//chr(13) an errechneter Position einfügen
insert(chr(13),tmp0,tmpint);
//String mit Zeilenumbruch sichtbar machen
label1.Caption:=tmp0;
end;
Hoffe daß ich helfen konnte.

Gruß Ronny.


Alle Zeitangaben in WEZ +1. Es ist jetzt 14:45 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz