Autor Beitrag
GigaNeko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Sa 22.01.05 12:58 
ich habe einen mediaplayer programiert. der titel der liedes, das abgespielt wird, wird in einem panel angezeigt. was muss ich machen, damit der text sich wie z.b. bei winamp in diesem panel bewegt?
MrSaint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1033
Erhaltene Danke: 1

WinXP Pro SP2
Delphi 6 Prof.
BeitragVerfasst: Sa 22.01.05 13:02 
nimm ne Timer Komponente, setz das Intervall auf z.B. 100 und dann schiebst im OnTimer-Ereignis dein Label einfach um bestimmt viele Pixel (z.B. 1 oder 2 oder so) nach links. Wenn nichts mehr zu sehen ist (wenn du also genügen weit links angekommen bist; dazu kannst mal die Methode Canvas.TextWidth anschauen!), dann setzt du Label.Left := Panel.Width und dann gehts wiedwer weiter wie vorher.
Wenn du kein Label hast, dann mach in deinem Panel die Caption leer und setz ein Labe drauf, dass der Titel darin angezeigt wird...


MrSaint

_________________
"people knew how to write small, efficient programs [...], a skill that has subsequently been lost"
Andrew S. Tanenbaum - Modern Operating Systems
GigaNeko Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Sa 22.01.05 15:19 
so ganz verstehe ich das nicht kannst du mir bitte ein beispiel geben?
MrSaint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1033
Erhaltene Danke: 1

WinXP Pro SP2
Delphi 6 Prof.
BeitragVerfasst: So 23.01.05 05:39 
also: pack nen timer auf deine Form, sagen wir der heißt "Timer1". dann schreibst du in das OnTimer Event von dem ungefähr das hier rein (angenommen du hast ein Panel "Panel1" und ein Label "Label1"; das Label liegt auf dem Panel und hat den Liedtitel in der Caption):
ausblenden Delphi-Quelltext
1:
2:
3:
4:
if ((-1) * Label1.Canvas.TextWidth(Label1.Caption)) <= Label1.Left then
  Label1.Left := Panel1.Width
else
  Label1.Left := Label1.Lest -1;




MrSaint


P.S.: keine garantie, is ja nun schon spät und ich brauch drngend meinen Schlaf ;) *gg*

_________________
"people knew how to write small, efficient programs [...], a skill that has subsequently been lost"
Andrew S. Tanenbaum - Modern Operating Systems