Bonjour,
suite à quelques recherche voici la solution que j'ai trouvé pour pouvoir utiliser la roulette de la sourie avec un scrollBox. je ne suis pas très bien l'évolution des objet delphi et donc il existe peut-être un scrollBox qui inclut cette fonction. Mais pour contribuer, voici ce que j'ai fait :

Tout dabord il faut que le scrollbox soit en Align : alclient. Si ce n'est pas le cas et pour ne pas tout changer dans la form il suffit de le mettre dans un panel par exemple et de donner la propriété alClient au scrollbox.

Ensuite, l'evennement qui "capte" bien la roulette est le FormMouseWheel de la form qui contient le scrollbox.

Enfin, le code à inserrer dans cet évennement est le suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
31
32
33
34
35
36
37
38
39
40
41
procedure TNomDeLaForm_e.FormMouseWheel(Sender: TObject; Shift: TShiftState;
    WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
var
  i: integer;
  PosHautGauche: TPoint;
  PosBasDroite: TPoint;
 
begin
 
  for i := 0 to TForm(Sender).ComponentCount - 1 do
    begin
      try
        if TForm(Sender).Components[i] is TScrollBox then
          begin
            if (TForm(Sender).Components[i] as Tscrollbox).CanFocus then
              begin
                PosHautGauche.X := (TForm(Sender).Components[i] as TScrollBox).Left;
                PosHautGauche.Y := (TForm(Sender).Components[i] as TScrollBox).Top;
                PosBasDroite.X := (TForm(Sender).Components[i] as TScrollBox).Left
                  + (TForm(Sender).Components[i] as TScrollBox).Width;
                PosBasDroite.Y := (TForm(Sender).Components[i] as TScrollBox).Top
                  + (TForm(Sender).Components[i] as TScrollBox).Height;
 
                PosHautGauche := TForm(Sender).ScreenToClient((TForm(Sender).Components[i] as TScrollBox).ClientToScreen(PosHautGauche));
                PosHautGauche.X := PosHautGauche.X + TForm(Sender).Left;
                PosHautGauche.Y := PosHautGauche.Y + TForm(Sender).Top + TForm(Sender).Height - TForm(Sender).ClientHeight;
 
                PosBasDroite := TForm(Sender).ScreenToClient((TForm(Sender).Components[i] as TScrollBox).ClientToScreen(PosBasDroite));
                PosBasDroite.X := PosBasDroite.X + TForm(Sender).Left;
                PosBasDroite.Y := PosBasDroite.Y + TForm(Sender).Top + TForm(Sender).Height - TForm(Sender).ClientHeight;
 
                if (MousePos.X > PosHautGauche.X) and (MousePos.Y > PosHautGauche.Y)
                  and (MousePos.X < PosBasDroite.X) and (MousePos.Y < PosBasDroite.Y)
                  then
                  (TForm(Sender).Components[i] as TScrollBox).VertScrollBar.Position := (TForm(Sender).Components[i] as TScrollBox).VertScrollBar.Position - WheelDelta;
              end;
          end;
      except
      end;
    end;
end;

voilà.

à plus
Laurent