Gdiplus::Graphics::LinearGradientBrush线性渐变画刷
HDC hdc = ::GetDC(m_hWnd); Graphics graphics(hdc); Gdiplus::Pen pen(Color(255, 0, 0, 255), 3); LinearGradientBrush linGrBrush(Point(10, 10), Point(200, 200), Color(255, 255, 0, 0), Color(255, 0, 0, 255)); //线性渐变画刷 /* 参数1:Point 颜色起点 参数2:Point 颜色终点 参数3:起点颜色 参数4:终点颜色 */ graphics.FillRectangle(&linGrBrush,10,10,200,200); //填充矩形 /* 参数1:LinearGradientBrush 画刷 参数2和参数3:矩形左上角坐标 参数4和参数5:矩形右下角坐标 */