X-ray spectra suffer significantly degraded spatial resolution when measured in the variable-pressure scanning electron microscope (VPSEM, chamber pressure 1 Pa to 2500 Pa) as compared to high-vacuum SEM (operating pressure < 10 mPa). Depending on the gas path length, electrons that are scattered hundreds of micrometers outside the focused beam can contribute 90% or more of the measured spectrum. Monte Carlo electron trajectory simulation, available in NIST DTSA-II, models the gas scattering and simulates mixed composition targets, e.g., particle on substrate. The impact of gas scattering at the major (C > 0.1 mass fraction), minor (0.01 <= C <= 0.1), and trace (C < 0.01) constituent levels can be estimated. NIST DTSA-II for Java-platforms is available free at: http://www.cstl.nist.gov/div837/837.02/epq/dtsa2/index.html).