Example 3 Suppose the lengths of the two legs of a right triangle are $a$ and $b$, and the length of the hypotenuse is $c$. If $a$, $b$, and $c$ are all positive integers, and $c=\frac{1}{3} a b-(a+b)$, find the number of right triangles that satisfy the condition.
(2010, National Junior High School Mathematics Competition, Tianjin Preliminary Round)
Solve: By the Pythagorean theorem, we have $c^{2}=a^{2}+b^{2}$.
Also, $c=\frac{1}{3} a b-(a+b)$, so
$$
c^{2}=\left[\frac{1}{3} a b-(a+b)\right]^{2} \text {. }
$$

Rearranging gives $a b-6(a+b)+18=0$.
Thus, $(a-6)(b-6)=18$.
Since $a$ and $b$ are both positive integers, and without loss of generality, let $a<b$, then,
$$
\left\{\begin{array} { l } 
{ a - 6 = 1 , } \\
{ b - 6 = 1 8 ; }
\end{array} \left\{\begin{array} { l } 
{ a - 6 = 2 , } \\
{ b - 6 = 9 ; }
\end{array} \left\{\begin{array}{l}
a-6=3, \\
b-6=6 .
\end{array}\right.\right.\right.
$$

Solving gives $\left\{\begin{array}{l}a=7, \\ b=24 ;\end{array}\left\{\begin{array}{l}a=8, \\ b=15 ;\end{array}\left\{\begin{array}{l}a=9, \\ b=12 .\end{array}\right.\right.\right.$
The corresponding $c=25,17,15$.
Therefore, there are 3 right-angled triangles that satisfy the conditions.