绘制五角星

使用滚动条模板:https://www.cnblogs.com/eternalmoonbeam/p/10827792.html

#define _USE_MATH_DEFINES
#include

在WM_PAINT——BeginPaint和EndPaint中写:

		x = xChar * xPos;
		y = yChar * yPos;
		MoveToEx(hdc, xStar - x, yStar - y, NULL);
		LineTo(hdc, xStar - SideLength / 2 - x,
			yStar + SideLength * (cos(double(3 * M_PI / 10)) + cos(double(M_PI / 10))) - y);
		LineTo(hdc, xStar + SideLength * cos(double(M_PI / 5)) - x,
			yStar + SideLength * cos(double(3 * M_PI / 10)) - y);
		LineTo(hdc, xStar - SideLength * cos(double(M_PI / 5)) - x,
			yStar + SideLength * cos(double(3 * M_PI / 10)) - y);
		LineTo(hdc, xStar + SideLength / 2 - x,
			yStar + SideLength * (cos(double(3 * M_PI / 10)) + cos(double(M_PI / 10))) - y);
		LineTo(hdc, xStar - x, yStar - y);

  

你可能感兴趣的:(绘制五角星)