//ȫֱMyListBoxrow
var
  Form1: TForm1;				//DelphiԶ
  MyListBox: TMyListBox;		//¶
  row: Integer;	

  //TMyListBox 
  TMyListBox = class(TListBox)
  private
    { Private declarations }
    procedure MouseIntoListbox(var Msg:TMessage); message CM_MOUSEENTER;
    procedure MouseFormListbox(var Msg:TMessage); message CM_MOUSELEAVE;
    procedure DrawInListBox(Color: TColor; const s:string);
  public
    { Public declarations }
  end;

 
//DrawInListBox
procedure  TMyListBox.DrawInListBox(Color: TColor; const s:string);
begin
  MyListBox.Canvas.Font.Color := Color; //ɫ
  MyListBox.Canvas.Font.Size := 13;    //
  MyListBox.Canvas.Font.Style := [fsBold]; //Ӵʾ
  MyListBox.Canvas.TextOut(10,row ,s);  //ӡϢ
  Inc(row ,25);
end;

//ʵMouseIntoListbox
procedure TMyListBox.MouseFormListbox(var Msg:TMessage);
begin
  DrawInListBox(clGreen,'б...');
end;

//ʵMouseFormListbox
procedure TMyListBox.MouseIntoListbox(var Msg:TMessage);
begin
  DrawInListBox(clNavy,'Ƴб...');
end;
			//¶
 
//ʾListBoxʵ
procedure TForm1.FormCreate(Sender: TObject);
begin
  MyListBox := TMyListBox.Create(Self);
  MyListBox.Parent := Self;
  MyListBox.Width := Self.ClientWidth div 2;
  MyListBox.Align := alLeft;
  row := 10;
end;
