Bonjour

Es-t’il possible d’évité le clignotement des images dans une listbox.

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
procedure TForm1.ListBoxDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
  X, Y: Integer;
begin
  X := Rect.Left+2;
  Y := Rect.Top;
 
 if odSelected in State then
   begin // Pas de selection
     ListBox.Canvas.Brush.Color := clWhite;
     ListBox.Canvas.Font.Color := clblack;
   end;
 
  ListBox.Canvas.Brush.Color := clWhite;
  ListBox.Canvas.Font.Color := clblack;
 
// ItemHeight = 30
// DoubleBuffered = True
 
  ListBox.Canvas.TextOut(X + 30, Y +5, ListBox.Items[Index]);
 
// Image 24 Px
  ListImage.Draw(ListBox.Canvas, X +1, Rect.Top +1, 0);
end;
Info : je n'est qu’une image dans la "ListImage"

Sa fait guirlande de Noël quand on scroll la Listbox

Merci pour votre réponse.