if (Sender is TControl) then begin
p.X := x;
p.Y := y;
P := Self.ScreenToClient(TControl(Sender).ClientToScreen(P));
h := GetSystemMenu(handle, false);
TrackPopupMenu(h, TPM_LEFTALIGN or TPM_LEFTBUTTON,
ClientOrigin.X + p.X ,
ClientOrigin.Y + p.y, 0, handle, nil);
end;
end;