![]() |
Schrift wie von "Geisterhand"
Moin,
sorry aber ich wusste einfach nicht was ich suchen sollte: Ich möchte das ein Label einen Text ausgibt, d. h. nacheinander sollen die einzelnen Buchstaben eingeblendet werden. Also wie wenn ich vorm Monitor sitze und zugucke wie jemand einen Text schreibt. Wie geht das ? Vielen Dank, |
Re: Schrift wie von "Geisterhand"
Du könntest mittels Timer immer einen Buchstaben mehr im Label darstellen lassen.
|
Re: Schrift wie von "Geisterhand"
Ähm ja, ich hab mir das jetzt einfach mal so gedacht: :mrgreen:
Code:
Funzt aber irgendwie bicht. :gruebel:
procedure TForm1.Timer1Timer(Sender: TObject);
var test: string; i : integer; begin test := 'Das ist ein Test'; i := i + 1; label1.Caption := test[i]; end; Irgendwie bin ich zu blöd... |
Re: Schrift wie von "Geisterhand"
Delphi-Quellcode:
var
Form1: TForm1; Wort: string = 'Hallo, das ist ein Demo-Text'; Loop: integer; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin Loop := 0; Label1.Caption := ''; Timer1.Interval := 250; end; procedure TForm1.Timer1Timer(Sender: TObject); begin if Loop = Length(Wort) then begin Loop := 0; Label1.Caption := ''; end; inc(Loop); Label1.Caption := Label1.Caption + Wort[Loop]; end; |
Re: Schrift wie von "Geisterhand"
Delphi-Quellcode:
:thumb: Aenogym
var i: integer;
procedure TForm1.Timer1Timer(Sender: TObject); const theText = 'Das ist ein Test'; begin i := i + 1; label1.Caption := label1.caption + theText[i]; end; edit: zu lahm |
Re: Schrift wie von "Geisterhand"
Vielen Dank an euch beide ! :thumb:
|
Re: Schrift wie von "Geisterhand"
oder auch
Delphi-Quellcode:
procedure Wait(Time: Word);
var Start: Cardinal; begin Start := GetTickCount; while GetTickCount-Start <= time do begin Application.ProcessMessages; Sleep(0); end; end; procedure TForm1.ShowText(Text: String); var i : Integer; begin Label1.Caption := ''; for i := 1 to Length(Text) do begin Label1.Caption := Label1.Caption + Text[i]; Wait(500); end; end; procedure TForm1.Button1Click(Sender: TObject); begin ShowText('Hallo'); end; |
Re: Schrift wie von "Geisterhand"
@Christian: Nur interessehalber, wozu hast du
Delphi-Quellcode:
in deinem Code?
Sleep(0);
|
Re: Schrift wie von "Geisterhand"
Edit: Sry verguckt :oops:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:58 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