SetTimer( 1, 10,0); //General animation needs 1/20 seconds continuously (20 frames per second), that is, a timer of 50 milliseconds, which is not as short as 10 milliseconds.
The simplest optimization method: in OnTimer, calculate two points, xunhuan and xunhuan- 1, to form a RECT, and use InvalidateRect instead of Invalidate realize partial redrawing, and the effect is basically tolerable.
Double buffering can optimize your program well. The process is a bit complicated. For the memDC of dialog box member variables, OnPaint created a compatible DC for the first time, OnTimer added a set of lines (MoveTo+LineTo), and OnPaint only needed BitBlt.