Autor Beitrag
.50AE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 100



BeitragVerfasst: Sa 02.12.06 22:23 
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:
ausblenden 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; //Wird für den Timer-Code benötigt
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; //Scrollen...
 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
ausblenden Delphi-Quelltext
1:
2:
3:
e_xalt := e_Xneu-DrawBox.HorzScrollBar.Position;
e_yalt := e_Yneu-DrawBox.VertScrollBar.Position;
//Die 2 zeilen sind dazu da eine Differenz zwischen den 2 x- und y-Koordinaten zu bekommen.


MfG
50ae