On the composition of H II regions in southern galaxies. III. NGC 2997 and 7793.