Items with two color in a ListBox

 



Procedure TForm1.ListBox1DrawItem ( Control : TWinControl ; Index : Integer ;

   Rect : TRect ; State : TOwnerDrawState ) ;

Begin

   With ( Control As TListBox ) Do

   Begin

      If Odd ( Index ) Then

         Canvas.Font.Color := clRed

      Else

         Canvas.Font.Color := clBlack ;

      Canvas.FillRect ( Rect ) ;

      Canvas.TextOut ( Rect.Left , Rect.Top , Items[ Index ] ) ;

   End ;

End ;

 


Back Home Foward