procedure TForm1.Timer1Timer(Sender: TObject);
var
MousePos: TPoint;
rgn :HRGN;
begin
GetCursorPos(MousePos);
rgn :=CreateRectRgn(Left,Top,Left+Width,Top+Height);
if PtInRegion(rgn,MousePos.X,MousePos.Y) then
Caption:=inttostr(MousePos.X);
DeleteObject(rgn);
end;