unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, FileCtrl;
type
TForm1 = class(TForm)
FileListBox1: TFileListBox;
Button1: TButton;
procedure FileListBox1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormCreate(Sender: TObject);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
hw:THintWindow;
implementation
{$R *.DFM}
procedure TForm1.FileListBox1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
var i:integer;
po: TPoint;
p
ointer;
rect :TRect;
begin
po := ClientToScreen(Point(X, Y));
po.x := FileListBox1.Left+po.x;
po.y := FileListBox1.Top+po.y;
i:=y div FileListBox1.ItemHeight;
if (i<FileListBox1.items.count) then
begin
//FileListBox1.Hint := FileListBox1.Items
;
rect := hw.CalcHintRect(po.x+200,FileListBox1.hint,p);
rect.Left := po.x+10;
rect.Right := po.x+length(FileListBox1.Items)*FileListBox1.Font.Size;
rect.Top := po.y;
rect.Bottom := po.y+FileListBox1.ItemHeight;
hw.Color := clInfoBk;
hw.ActivateHint(rect,FileListBox1.Items);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FileListBox1.ShowHint := false;
hw := THintWindow.Create(self);
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var rect :TRect;
p: pointer;
begin
rect := hw.CalcHintRect(0,FileListBox1.hint,p);
hw.ActivateHint(rect,'');
end;
end.