Drawing a Shaded Rectangle

To draw a shaded rectangle from [0,0] to [100,32], define a TRIVERTEX array with two elements and a single GRADIENT_RECT structure. The following example shows a horizontal GradientFill rectangle call.

TRIVERTEX        vert[2] ;
GRADIENT_RECT    gRect;
vert [0] .x      = 0;
vert [0] .y      = 0;
vert [0] .Red    = 0x0000;
vert [0] .Green  = 0x0000;
vert [0] .Blue   = 0x0000;
vert [0] .Alpha  = 0x0000;

vert [1] .x      = 100;
vert [1] .y      = 32; 
vert [1] .Red    = 0x0000;
vert [1] .Green  = 0x0000;
vert [1] .Blue   = 0xff00;
vert [1] .Alpha  = 0x0000;

gRect.UpperLeft  = 0;
gRect.LowerRight = 1;
GradientFill(hdc,vert,2,&gRect,1,GRADIENT_FILL_RECT_H);