roud59
Messages postés99Date d'inscriptionjeudi 16 septembre 2004StatutMembreDernière intervention26 juillet 20072 7 juil. 2005 à 11:42
Exemple :
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
with ComboBox1 do begin
Canvas.FillRect(Rect); // Effacer avant d'écrire
if Index = 1 then // On détermine la couleur
Canvas.Font.Color := clRed // Mettre en rouge
else
Canvas.Font.Color := clLime; // Mettre en vert
if Index >= 0 then
Canvas.TextOut(Rect.Left + 2, Rect.Top, Items[Index]); // Dessin de la couleur spécicfiée
end;
end;
Ne pas oublier de mettre le style du combo à csOwnerDrawVariable ou csOwnerDrawFixed