The Shack-Hartmann or Hartmann-Shack wavefront sensors are particular forms of the Hartmann sensor and are the most commonly used in adaptive optics. The traditional Hartmann screen in the pupil is replaced by an array of small lenslets at a conjugate to an image of the pupil or deformable mirror. Each lenslet forms an independent image of the incoming wavefront. Shifts in the positions of these images can be shown by simple geometric optics to be proportional to the mean wavefront gradient over each lenslet. The measurement range or dynamic range of a conventional Shack-Hartmann sensor is normally limited by the sub-aperture size of the detector plane, in which each spot should remain. In order to overcome this restriction, several methods, such as modified unwrapped algorithm or a spatial-light modulator as a shutter, have been proposed. We first simulated the image forming of a conventional Shack-Hartmann wavefront sensor for highly aberrated spherical aberrations through computer simulation, which confirmed that the well-known effect that high aberration shifts the spots outside its conventionally detectable area. We first develop a computer program that simulates Shack-Hartmann’s image forming and we show that simple defocusing the CCD plane can allocate the out-boundary spots to initial or reference positions, which results in the increase of the dynamic range of the Shack-Hartmann sensor.