METHOD PaintHeader( nRow, nCol, nHeight, lInvert, hDC ) CLASS TXBrwColumn
local hBrush
local oFont
local aColors, aBitmap
local cHeader
local nWidth, nBmpRow, nBmpCol, nBmpNo
local lOwnDC, nBottom
DEFAULT lInvert := .f.
if ::bClrHeader == nil
::Adjust()
endif
if nCol != nil
if nCol != 0
::nDisplayCol := nCol
endif
else
nCol := ::nDisplayCol
endif
if ! lInvert
aColors := Eval( ::bClrHeader )
else
aColors := { CLR_WHITE, CLR_BLUE }
endif
if hDC == nil
hDC := ::oBrw:GetDC()
lOwnDC := .f.
else
lOwnDC := .t.
endif
oFont := ::oHeaderFont
cHeader := ::cHeader
nWidth := ::nWidth
nBmpNo := ::nHeadBmpNo
nBottom = nRow + ( nHeight / 3 )
if ::oBrw:l2007
if ! lInvert
Gradient( hDC, { nRow - 1, nCol, nBottom, nCol + nWidth + 2 },;
nRGB( 219, 230, 244 ), nRGB( 207, 221, 239 ), .T. )
Gradient( hDC, { nBottom + 1, nCol, nRow + nHeight - 1, nCol + nWidth },;
nRGB( 201, 217, 237 ), nRGB( 231, 242, 255 ), .T. )
else
Gradient( hDC, { nRow - 1, nCol, nBottom, nCol + nWidth },;
nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ), .T. )
Gradient( hDC, { nBottom + 1, nCol, nRow + nHeight - 1, nCol + nWidth },;
nRGB( 255, 215, 84 ), nRGB( 255, 233, 162 ), .T. )
endif
else
hBrush := CreateSolidBrush( aColors[ 2 ] )
FillRect( hDC, { nRow, nCol, nRow + nHeight, nCol + nWidth }, hBrush )
DeleteObject( hBrush )
endif
nCol += ( COL_EXTRAWIDTH / 2 )
nWidth -= COL_EXTRAWIDTH
nRow += ( ROW_EXTRAHEIGHT / 2 )
nHeight -= ROW_EXTRAHEIGHT
if nBmpNo > 0 .and. nBmpNo <= Len( ::aBitmaps )
aBitmap := ::aBitmaps[ nBmpNo ]
nWidth -= aBitmap[ BITMAP_WIDTH ]
if Empty(cHeader)
nBmpCol := nCol + nwidth / 2
elseif ::nHeadBmpAlign == AL_LEFT
nBmpCol := nCol
nCol += aBitmap[ BITMAP_WIDTH ] + BMP_EXTRAWIDTH
else
nBmpCol := nCol + nWidth
endif
nWidth -= BMP_EXTRAWIDTH
nBmpRow := ( nHeight - aBitmap[ BITMAP_HEIGHT ] ) / 2 + 4
if ! ::oBrw:l2007
PalBmpDraw( hDC, nBmpRow, nBmpCol,;
aBitmap[ BITMAP_HANDLE ],;
aBitmap[ BITMAP_PALETTE ],;
aBitmap[ BITMAP_WIDTH ],;
aBitmap[ BITMAP_HEIGHT ];
,, .t., aColors[ 2 ] )
else
DEFAULT aBitmap[ BITMAP_ZEROCLR ] := GetZeroZeroClr( hDC, aBitmap[ BITMAP_HANDLE ] )
SetBkColor( hDC, nRGB( 255, 255, 255 ) )
TransBmp( aBitmap[ BITMAP_HANDLE ], aBitmap[ BITMAP_WIDTH ], aBitmap[ BITMAP_HEIGHT ],;
aBitmap[ BITMAP_ZEROCLR ], hDC, nBmpCol, nBmpRow, nBmpWidth( aBitmap[ BITMAP_HANDLE ] ),;
nBmpHeight( aBitmap[ BITMAP_HANDLE ] ) )
endif
endif
if Empty( cHeader )
::oBrw:ReleaseDC()
return nil
endif
oFont:Activate( hDC )
SetTextColor( hDC, aColors[ 1 ] )
SetBkColor( hDC, aColors[ 2 ] )
SetBkMode ( hDC, 1 ) // transparent
DrawTextEx( hDC, cHeader,;
{nRow, nCol, nRow + nHeight, nCol + nWidth},;
::nHeadStyle )
oFont:Deactivate( hDC )
if !lOwnDC
::oBrw:ReleaseDC()
endif
return nil