Share add on xbrowse 3D header codes
Posted: Mon Dec 03, 2007 1:12 am
Hi,
METHOD PaintHeader( nRow, nCol, nHeight, lInvert, hDC ) CLASS TXBrwColumn
...
// begin add on
nTop = 0
nBottom = nTop + nHeight1
nLeft := ncol-2
nRight = Min( nLeft + ::nwidth , ::obrw:nWidth )
if ncol == Len( ::obrw:acols )
nRight = nWidth
endif
WndBox( hDC, ntop-1 , nLeft - 2, nBottom+1, nRight-1 )
WndBoxRaised( hDC, nTop+1, nLeft-1, nBottom , nRight-1 )
// end add on
oFont:Deactivate( hDC )
if !lOwnDC
::oBrw:ReleaseDC()
endif
return nil
METHOD Paint() CLASS TXBrowse
...
/*
Paint Header
*/
replace
if ::lHeader
...
end
with:
if ::lHeader
if !lOnlyData
nRow := 0
nHeight := ::nHeaderHeight - 3
// top line
MoveTo( hDC,1, nRow)
LineTo( hDC, nBrwWidth, nRow, hGrayPen )
nRow++
MoveTo( hDC, 1, nRow )
LineTo( hDC, nBrwWidth, nRow, hWhitePen )
nRow++
MoveTo( hDC, 1, nRow + nHeight)
LineTo( hDC, nBrwWidth, nRow + nHeight , hGrayPen )
aColors := Eval( ::bClrHeader, Self )
hBrush := CreateSolidBrush( aColors[ 2 ] )
FillRect( hDC, {nRow, 2, nRow + nHeight, nBrwWidth}, hBrush )
DeleteObject( hBrush )
for nFor := 1 to nLast
nCol := aCols[ nFor ]
oCol := ::ColAtPos( nFor )
oCol:PaintHeader( nRow, nCol, nHeight )
next
// paint space right col header, 2007 look
nTop = 0
nBottom = nTop + nHeight
nLeft := ncol
nRight = ::nWidth
nWidth:=nright
nBottom = nRow + ( nHeight / 3 )
Gradient( hDC, { nRow - 1, nCol+ocol:nwidth, nBottom, nCol + nWidth + 2 },;
nRGB( 219, 230, 244 ), nRGB( 207, 221, 239 ), .T. )
Gradient( hDC, { nBottom + 1, nCol+ocol:nwidth, nRow + nHeight - 1, nCol + nWidth },;
nRGB( 201, 217, 237 ), nRGB( 231, 242, 255 ), .T. )
// 3d header box
nTop = 0
nBottom = nTop + nHeight
nLeft := ncol
nRight = ::nWidth
WndBox( hDC, ntop - 1, nLeft+ocol:nwidth, nBottom+1, nRight-1 )
WndBoxRaised( hDC, nTop+1, nLeft+1+ocol:nwidth, nBottom , nRight - 1 )
endif
nFirstRow += ::nHeaderHeight
endif
Have a fun
Shuming Wang
METHOD PaintHeader( nRow, nCol, nHeight, lInvert, hDC ) CLASS TXBrwColumn
...
// begin add on
nTop = 0
nBottom = nTop + nHeight1
nLeft := ncol-2
nRight = Min( nLeft + ::nwidth , ::obrw:nWidth )
if ncol == Len( ::obrw:acols )
nRight = nWidth
endif
WndBox( hDC, ntop-1 , nLeft - 2, nBottom+1, nRight-1 )
WndBoxRaised( hDC, nTop+1, nLeft-1, nBottom , nRight-1 )
// end add on
oFont:Deactivate( hDC )
if !lOwnDC
::oBrw:ReleaseDC()
endif
return nil
METHOD Paint() CLASS TXBrowse
...
/*
Paint Header
*/
replace
if ::lHeader
...
end
with:
if ::lHeader
if !lOnlyData
nRow := 0
nHeight := ::nHeaderHeight - 3
// top line
MoveTo( hDC,1, nRow)
LineTo( hDC, nBrwWidth, nRow, hGrayPen )
nRow++
MoveTo( hDC, 1, nRow )
LineTo( hDC, nBrwWidth, nRow, hWhitePen )
nRow++
MoveTo( hDC, 1, nRow + nHeight)
LineTo( hDC, nBrwWidth, nRow + nHeight , hGrayPen )
aColors := Eval( ::bClrHeader, Self )
hBrush := CreateSolidBrush( aColors[ 2 ] )
FillRect( hDC, {nRow, 2, nRow + nHeight, nBrwWidth}, hBrush )
DeleteObject( hBrush )
for nFor := 1 to nLast
nCol := aCols[ nFor ]
oCol := ::ColAtPos( nFor )
oCol:PaintHeader( nRow, nCol, nHeight )
next
// paint space right col header, 2007 look
nTop = 0
nBottom = nTop + nHeight
nLeft := ncol
nRight = ::nWidth
nWidth:=nright
nBottom = nRow + ( nHeight / 3 )
Gradient( hDC, { nRow - 1, nCol+ocol:nwidth, nBottom, nCol + nWidth + 2 },;
nRGB( 219, 230, 244 ), nRGB( 207, 221, 239 ), .T. )
Gradient( hDC, { nBottom + 1, nCol+ocol:nwidth, nRow + nHeight - 1, nCol + nWidth },;
nRGB( 201, 217, 237 ), nRGB( 231, 242, 255 ), .T. )
// 3d header box
nTop = 0
nBottom = nTop + nHeight
nLeft := ncol
nRight = ::nWidth
WndBox( hDC, ntop - 1, nLeft+ocol:nwidth, nBottom+1, nRight-1 )
WndBoxRaised( hDC, nTop+1, nLeft+1+ocol:nwidth, nBottom , nRight - 1 )
endif
nFirstRow += ::nHeaderHeight
endif
Have a fun
Shuming Wang