Hallo,
Ich habe eine TScrolLBox die ich nun mit gedrückter rechter Maustaste scrollen will.
D.h. man hält die rechte Maustate gedrückt und fährt z.b. nach links.
Dann soll die Scrollbox nach rechts scrollen, so, als würde man den Inhalt nach links "ziehen"...
Hier ist mein Ansatz, der leider nur halb funktioniert..
(D.h. man kann problemlos nach links/oben scrollen, aber nicht richtig nach links/unten.
Es scrollt dann nämlich immer nach links/unten und gleich wieder zurück.. [oder umgekehrt])
Vielleicht bin ich inzwischen auch zu müde/etc. um den Fehler zu sehen.
Scrollbox (
DrawBox) OnMouseMove:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
| procedure Tmain.DrawBoxMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin if e_ziehen=true then begin e_xneu := x-DrawBox.HorzScrollBar.Position; e_yneu := y-DrawBox.VertScrollBar.Position; if e_xalt < e_xneu then DrawBox.HorzScrollBar.Position:=DrawBox.HorzScrollBar.Position-3 else DrawBox.HorzScrollBar.Position:=DrawBox.HorzScrollBar.Position+3; if e_yalt < e_yneu then DrawBox.VertScrollBar.Position:=DrawBox.VertScrollBar.Position-3 else DrawBox.VertScrollBar.Position:=DrawBox.VertScrollBar.Position+3; end; end; |
Timer mit Intervall 100
Delphi-Quelltext
1: 2: 3:
| e_xalt := e_Xneu-DrawBox.HorzScrollBar.Position; e_yalt := e_Yneu-DrawBox.VertScrollBar.Position; |
MfG
50ae