一、通过划分成小个矩形进行渐变填充 CRect rectangle; //分割客户区域成小矩形,逐个填充 for (int i = x1; i < x2; i++) { rectangle.SetRect(i, y1, i + 1, y2); m_pDC->FillSolidRect(&rectangle, RGB(255, 255, 255 - MulDiv(i, 255, x2-x1))); }