unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    ComboBox1: TComboBox;
    procedure FormShow(Sender: TObject);
    procedure ComboBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);

  private

  public

  end;

var
  Form1: TForm1;

implementation
{$R *.dfm}
{------------------------------------------------------------------------------}
procedure TForm1.FormShow(Sender: TObject);
var
   kom : STring;

begin
   kom := '';

   kom := kom + 'Ustawiamy w ComboBox Style na csOwnerDrawFixed' + #10#13;
   kom := kom + 'W onDrawItem piszemy obs³ugê rysowania';

   ShowMessage(kom);
end;

procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
   tw : Integer;

begin
   with ComboBox1.Canvas do
   begin
      Font.Size := 10;
      tw := TextWidth(ComboBox1.Items.Strings[Index]) + 2;
      FillRect(Rect);
      TextOut(Rect.Left, Rect.Top, ComboBox1.Items.Strings[Index]);
      Font.Size := 6;
      TextOut(Rect.Left + tw, Rect.Top, ComboBox1.Items.Strings[Index]);
   end;
end;

end.

