i have this Code to paint a Gradient.
it work in 32 Bit App but fail in 64 Bit App whre i only get "black" ... WHY
Code: Select all
HBRUSH LinearGradientBrush( HDC pDC, long cx, long cy, COLORREF crFrom, COLORREF crTo, BOOL bVert )
{
HDC memDC;
HBITMAP memBmp;
HBRUSH pGradientBrush = ( HBRUSH ) NULL;
memDC = CreateCompatibleDC( pDC );
memBmp = CreateCompatibleBitmap( pDC, cx, cy );
if( memDC && memBmp )
{
TRIVERTEX rcVertex[ 3 ];
GRADIENT_RECT gRect;
rcVertex[ 0 ].x = 0;
rcVertex[ 0 ].y = 0;
rcVertex[ 0 ].Red = ( unsigned short ) ( GetRValue( crFrom ) << 8 );
rcVertex[ 0 ].Green = ( unsigned short ) ( GetGValue( crFrom ) << 8 );
rcVertex[ 0 ].Blue = ( unsigned short ) ( GetBValue( crFrom ) << 8 );
rcVertex[ 0 ].Alpha = 0;
rcVertex[ 1 ].x = cx;
rcVertex[ 1 ].y = cy;
rcVertex[ 1 ].Red = ( unsigned short ) ( GetRValue( crTo ) << 8 );
rcVertex[ 1 ].Green = ( unsigned short ) ( GetGValue( crTo ) << 8 );
rcVertex[ 1 ].Blue = ( unsigned short ) ( GetBValue( crTo ) << 8 );
rcVertex[ 1 ].Alpha = 0;
rcVertex[ 2 ].x = cx;
rcVertex[ 2 ].y = cy;
rcVertex[ 2 ].Red = ( unsigned short ) ( GetRValue( crFrom ) << 8 );
rcVertex[ 2 ].Green = ( unsigned short ) ( GetGValue( crFrom ) << 8 );
rcVertex[ 2 ].Blue = ( unsigned short ) ( GetBValue( crFrom ) << 8 );
rcVertex[ 2 ].Alpha = 0;
gRect.UpperLeft = 0;
gRect.LowerRight = 1;
SelectObject( memDC, memBmp );
GdiGradientFill( memDC, rcVertex, 3, &gRect, 2, bVert ? GRADIENT_FILL_RECT_V : GRADIENT_FILL_RECT_H );
pGradientBrush = CreatePatternBrush( memBmp );
DeleteObject( memBmp );
DeleteObject( memDC );
}
return pGradientBrush;}
who have a Idea