In order to study the contrast difference between scanning ion microscopes (SIM) and scanning electron microscopes (SEM), the depth and lateral distributions of secondary electrons escaped from surfaces of 17 metals with atomic numbers, Z(2), of 4-79 were calculated for bombardment with 30 keV Ga ions and for 10 keV electrons. For both projectiles, the excitation depth generally decreased with increasing Z(2), while showing the same periodic change as the secondary-electron yield. However, an opposite trend in Z(2) dependence between the Ga ion and electron bombardments was calculated with the lateral distribution of secondary electrons escaped from the surface. Except for low Z(2) metals, the lateral distribution, which is much narrower for 30 keV Ga ions than for 10 keV electrons, indicates that the spatial resolution of the secondary-electron images is better for SIM than for SEM, if zero-sized probe beams are assumed. Furthermore, the present calculation reveals important effects of electron excitation by recoiled material atoms and reflected electrons on the lateral distribution, as well as the secondary-electron yield, for the Ga ion and electron bombardments, respectively.