I had to think of a way of preventing him from following me around all morning.这里a way后面为什么用of ,用to可以吗

问题描述:

I had to think of a way of preventing him from following me around all morning.这里a way后面
为什么用of ,用to可以吗

很迷惑 求高人解答
但是不要解释为固定用法

a way of 后面是加 doing,而a way to后面是加to do.
在这句中,既然preventing 是ing形式,那就应该是用of.