Combinations way:
there are 7 dots, with a line of 5 and a line of 3 - like: ( .'s are just for spacing...)
* * * * *
. . . *. . .
. . . *. . .
You need 3 dots to make a triangle. So there are
7C3 = 35 different 'triangles'
However: some of these are on the lines, and so they arent actually triangles. There are two lines.
5C3 = 10 'triangles' are on the line with 5 dots, and
3C3 = 1 'triangle' is on the line with 3 dots.
So: there are 7C3 - 5C3 - 3C3 = 24 triangles all up.