Autor Beitrag
torstenheinze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 461



BeitragVerfasst: Fr 07.03.03 20:37 
du kannst auch das label mit dem hintergrundbild in einen frame machen
delphi_noop
Hält's aus hier
Beiträge: 15

Win XP
Delphi 7
BeitragVerfasst: Do 28.05.09 14:27 
Hallo!

Hab auch gerade gesucht, wie man eine Laufschrift programmiert!
Danke für eure wirklich guten und kompetenten Tipps, sie haben mir das Programmieren einer etwas anderen Laufschrift erheblich erleichtert!!
Danke vielmals... :o
FinnO
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1331
Erhaltene Danke: 123

Mac OSX, Arch
TypeScript (Webstorm), Kotlin, Clojure (IDEA), Golang (VSCode)
BeitragVerfasst: Do 28.05.09 14:40 
ganz vorsichtig:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Timer1OnTimer(Sender: TObject);
begin
  Label1.Caption := Label1.Caption[Length(Label1.Caption)] +
                    Copy(Label1.Caption,2,Length(Label1.Caption)-1); 
                    //letzten Buchstaben nach vorne holen!
end;
Frühlingsrolle
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 06.08.09 02:10 
- Nachträglich durch die Entwickler-Ecke gelöscht -
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Do 06.08.09 11:04 
user profile iconFinnO hat folgendes geschrieben Zum zitierten Posting springen:
ganz vorsichtig:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Timer1OnTimer(Sender: TObject);
begin
  Label1.Caption := Label1.Caption[Length(Label1.Caption)] +
                    Copy(Label1.Caption,2,Length(Label1.Caption)-1); 
                    //letzten Buchstaben nach vorne holen!
end;


Mit einer Nicht-Proportionalschrift aber nur.
wunsiedler
ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 506
Erhaltene Danke: 4

Win7

BeitragVerfasst: Do 06.08.09 16:22 
Mhh... ich nehme ein Textfeld mit der Schrift Courier und Größe 10, einen Timer und folgenden Code:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
var
  Form1: TForm1; 
  zeit,ls: integer;
  t: string;
implementation

{ TForm1 }

procedure TForm1.FormCreate(Sender: TObject);
begin
  Edit1.BorderStyle:=bsnone;
  Edit1.Color:= clBtnFace;
  zeit:=0;
  ls:= Edit1.Left;
  t := '+++ 100g Rindfleisch 1,69 Euro +++ 200g Salami 3,56 Euro +++ 1kg Bananen 1,79 Euro ';
  Edit1.Text:= t;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  zeit := zeit + 1 ;
  if(zeit=8)then
  begin
   zeit:=0;
   t := copy(t,2,length(t)-1) + copy(t,1,1);
   Edit1.Text:= t;
  end;
  Edit1.Left := ls-zeit;

end;
Einloggen, um Attachments anzusehen!
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Do 06.08.09 17:59 
Also ich hab mal eins implementiert, das mit jeder beliebigen Schriftart funktionieren sollte. Lässt sich auch transparent machen (zum Beispiel über die transparente Farbe eines Images).

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
type
  TLauftext = record
    Text: string;
    StepWidth: Byte;
    Font: TFont;
    Left, Top, Width: Integer;
    index: Integer;
  end;
  ...


ausblenden Delphi-Quelltext
1:
2:
3:
4:
var
  ...
  Lauftext: TLauftext;
  ...


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Lauftext.index := Lauftext.index + 1;
  PaintBox1.Canvas.Font := Lauftext.Font;
  if -Lauftext.index * Lauftext.StepWidth +
       PaintBox1.Canvas.TextWidth(Lauftext.Text) < 0 then
    Lauftext.index := -(Lauftext.Width div Lauftext.StepWidth);
  PaintBox1.Canvas.Pen.Color := Lauftext.Font.Color;
  PaintBox1.Canvas.Brush.Color := clWhite;
  PaintBox1.Canvas.Brush.Style := bsSolid;
  PaintBox1.Canvas.Rectangle(Lauftext.Left, Lauftext.Top, Lauftext.Width,
    Lauftext.Top + PaintBox1.Canvas.TextHeight('X') + 2);
  PaintBox1.Canvas.Brush.Style := bsClear;
  PaintBox1.Canvas.TextOut(-Lauftext.index * Lauftext.StepWidth,
    Lauftext.Top + 2, Lauftext.Text);
  PaintBox1.Canvas.Rectangle(Lauftext.Left, Lauftext.Top, Lauftext.Width,
    Lauftext.Top + PaintBox1.Canvas.TextHeight('X') + 2);
end;


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.FormCreate(Sender: TObject);
begin
  ...
  Lauftext.Text := 'Willkommen bei PennyMarkt.';
  Lauftext.StepWidth := 20;
  Lauftext.Font := TFont.Create;
  Lauftext.Font.Name := 'Arial';
  Lauftext.Font.Size := 16;
  Lauftext.Font.Style := [];
  Lauftext.Font.Color := clRed;
  Lauftext.Left := 0;
  Lauftext.Top := 0;
  Lauftext.Width := 250;
  Lauftext.index := -1;
end;


ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Lauftext.Font.Free;
end;


ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject);
begin
  Timer1.Enabled := not Timer1.Enabled;
end;


Wobei sich auf dem Formular ein Timer, eine Paintbox mit idealerweise Width = Lauftext.Width und ein Button für den Start und Stop des Lauftextes.