Tabela de conteúdos

Descrição

Mostra um hint em um item de um ListBox

Implementação

Delphi

Esse código deve ser implementado no evento OnMouseMove do ListBox. A propriedade ShowHints deve estar como true.

O Items[lstIndex] determina o hint que aparecerá.

procedure TForm1.ListBox1MouseMove (Sender: TObject; Shift: TShiftState; X, Y: Integer) ;
 var lstIndex : Integer ;
begin
  with ListBox1 do
  begin
    lstIndex:=SendMessage(Handle, LB_ITEMFROMPOINT, 0, MakeLParam(x,y)) ;
    if (lstIndex >= 0) and (lstIndex <= Items.Count) then 
        Hint := Items[lstIndex]
    else
        Hint := ''
  end;
end;

Fonte: http://delphi.about.com/cs/adptips2001/a/bltip0201_4.htm