In the integrated chip industry, there is a growing demand of defect detection, and the autofocus capability of microscopy can significantly enhance efficiency. This paper presents a novel technique based on an autofocus methodology known as the eccentric light beam approach. Specifically, we have developed a line-stripe-shaped laser beam projection system that uses a linear array CCD, offering high resolution and instant response. The simple design of the linear array CCD overcomes noise interference caused by system processing tolerances and reduces signal processing complexity. In accordance to the proposed system, we designed a novel algorithm called adaptive multiscale windowing to calculate the centroid of the linear array image which is an essential criterion of the defocus value. Additionally, we explore the relationship between sample defocus amount and the centroid position shift of the received signal. We build the motion part with the resolution of less than 1 micron and response speed of less than 100 milliseconds. From the experiments conducted, we achieved the accuracy of less than 1 micron and the focusing speed within 0.2 second.