Items with two color in a ComboBox

 



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

   Rect : TRect ; State : TOwnerDrawState ) ;

Begin

   With ( Control As TComboBox ) 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