我想用渐变色来填充一个矩形,程序片段如下:
#pragma comment(lib, "msimg32")
..... TRIVERTEX vert[2] ;
GRADIENT_RECT gRect;
vert [0] .x = rect.left;
vert [0] .y = rect.bottom-100;
vert [0] .Red = 57;
vert [0] .Green = 52;
vert [0] .Blue = 173;
vert [0] .Alpha = 0; vert [1] .x = rect.right;
vert [1] .y = rect.bottom;
vert [1] .Red = 0;
vert [1] .Green = 48;
vert [1] .Blue = 156;
vert [1] .Alpha = 0; gRect.UpperLeft = 0;
gRect.LowerRight = 1;
GradientFill(dc.GetSafeHdc (),vert,2,&gRect,1,GRADIENT_FILL_RECT_H);
原本打算画蓝色的渐变色(颜色设置没有错),结果成了黑色的,Alpha都设置为255也不行,请问哪里出错了?
#pragma comment(lib, "msimg32")
..... TRIVERTEX vert[2] ;
GRADIENT_RECT gRect;
vert [0] .x = rect.left;
vert [0] .y = rect.bottom-100;
vert [0] .Red = 57;
vert [0] .Green = 52;
vert [0] .Blue = 173;
vert [0] .Alpha = 0; vert [1] .x = rect.right;
vert [1] .y = rect.bottom;
vert [1] .Red = 0;
vert [1] .Green = 48;
vert [1] .Blue = 156;
vert [1] .Alpha = 0; gRect.UpperLeft = 0;
gRect.LowerRight = 1;
GradientFill(dc.GetSafeHdc (),vert,2,&gRect,1,GRADIENT_FILL_RECT_H);
原本打算画蓝色的渐变色(颜色设置没有错),结果成了黑色的,Alpha都设置为255也不行,请问哪里出错了?
TRIVERTEX vert[2] ;
GRADIENT_RECT gRect;
vert [0] .x = rect.left;
vert [0] .y = rect.bottom-100;
vert [0] .Red = 0x3900;
vert [0] .Green = 0x3400;
vert [0] .Blue = 0xad00;
vert [0] .Alpha = 0; vert [1] .x = rect.right;
vert [1] .y = rect.bottom;
vert [1] .Red = 0x0;
vert [1] .Green = 0x3000;
vert [1] .Blue = 0x9c00;
vert [1] .Alpha = 0; gRect.UpperLeft = 0;
gRect.LowerRight = 1;
GradientFill(pDC->GetSafeHdc(),vert,2,&gRect,1,GRADIENT_FILL_RECT_H);