Regarding the problem that the traditional straight-line generating has a low accuracy, we study straightline generating with the distance of point to line. We explore generating a line to approximate the ideal line and the issue is to pick out the pixel point of approximating the ideal line. The paper plays a significant scientific role in elucidating linear optimization norm and it lays a foundation for showing a straight line. The algorithm is valuable for computer graphics.