GradientFill 画渐变矩形或3角形

#pragma comment (lib, "Msimg32") int _tmain(int argc, _TCHAR* argv[]) { HDC lWndDC= GetWindowDC(NULL); RECT lrtRect; lrtRect.left = 0; lrtRect.top = 0; lrtRect.right = 500; lrtRect.bottom = 500; COLORREF col_from = RGB(255, 121,121); COLORREF col_to = RGB(255, 121,0); BOOL vert_grad=FALSE; TRIVERTEX vert[2]; GRADIENT_RECT mesh; vert[0].x = lrtRect.left; vert[0].y = lrtRect.top; vert[0].Alpha = 0x0000; vert[0].Blue = GetBValue(col_from)<<8; vert[0].Green = GetGValue(col_from)<<8; vert[0].Red = GetRValue(col_from)<<8; vert[1].x = lrtRect.right; vert[1].y = lrtRect.bottom; vert[1].Alpha = 0x0000; vert[1].Blue = GetBValue(col_to) <<8; vert[1].Green = GetGValue(col_to) <<8; vert[1].Red = GetRValue(col_to) <<8; mesh.UpperLeft = 0; mesh.LowerRight = 1; GradientFill( lWndDC, vert, 2, &mesh, 1, vert_grad ? GRADIENT_FILL_RECT_V : GRADIENT_FILL_RECT_H ); DeleteDC(lWndDC); Sleep(2000); return 0; }

你可能感兴趣的:(null)