@ 20, 145 FOLDEREX SIZE 178, 110 oFld1 PIXEL ROUND 5 ; // Top, Left, Width, Height
PROMPT "&Color", "&Grad.", "&Brush", "&Img." OF oDlg1 ;
BITMAPS "Page", "Page", "Page", "Page" ;
ON PAINT TAB PaintTab( Self, nOption )
oFld1:lTransparent := .T.
oFld1:nFolderHeight := 30
oFld1:nSeparator := 3
oFld1:nRound := 5
oFld1:bClrText := {| o, n | 128 } // red Tab-text
oFld1:oFont := oFont // Tab-font
oFld1:DisableTab( 2 )
F_PAGE1( oFld1 )
F_PAGE2( oFld1 )
F_PAGE3( oFld1 )
F_PAGE4( oFld1 )
F_BACKGRD( oFld1, lDDirect, nDColorF, nDColorB, nDGradPos, cDBrush, cDImage )
...
...
FUNCTION PaintTab( o, nOption )
LOCAL hBrush, hBmp, nLastRow
IF nOption == 2 // disabled !!!
hBmp = ReadBitmap( 0, c_path + "\Images\stone.bmp" )
hBrush = CreatePatternBrush( hBmp )
DeleteObject( hBmp )
nLastRow = o:aPos[ o:aLines[ o:aOrder[ 1 ] ][ 1 ] ][ 2 ] + o:nFolderHeight
SetBrushOrgEx( o:hDC, 1, nLastRow + 2 )
RETURN hBrush
ENDIF
IF nOption == o:nOption .and. nOption == 3 // Brush of a selected Tab
hBmp = ReadBitmap( 0, c_path + "\Images\marble.bmp" )
hBrush = CreatePatternBrush( hBmp )
DeleteObject( hBmp )
nLastRow = o:aPos[ o:aLines[ o:aOrder[ 1 ] ][ 1 ] ][ 2 ] + o:nFolderHeight
SetBrushOrgEx( o:hDC, 1, nLastRow + 2 )
RETURN hBrush
ENDIF
RETURN o:SetFldColors( o, nOption )
// -------- FOLDER - Backgrounds ---------------
FUNCTION F_BACKGRD( oFld, lDirect, nColor1, nColor2, nMove, cBrush, cImage )
LOCAL n, oDlg, hDC, oBrush, oImage, nRow := 0, nCol := 0, lFound := .T.
LOCAL aGrad1 := { { nMove, nColor1, nColor1 }, { nMove, nColor1, nColor1 } }
LOCAL aGrad2 := { { nMove, nColor1, nColor2 }, { nMove, nColor2, nColor1 } }
//LOCAL PixelX := MulDiv(oFld:nWidth(), nLoWord( GetDlgBaseUnits() ), 4)
//LOCAL PixelY := MulDiv(oFld:nHeight(), nHiWord( GetDlgBaseUnits() ), 8)
PixelX := 0.3
PixelY := 0.3
// shows a different Brush on each Page !!!
// ------------------------------------------------
FOR n := 1 to Len( oFld:aDialogs )
oDlg := oFld:aDialogs[ n ]
hDC = CreateCompatibleDC( oDlg:GetDC() )
IF n = 1 // Color
hBmp = CreateCompatibleBitMap( oDlg:hDC, 380, 236 ) // Width, Height
hBmpOld = SelectObject( hDC, hBmp )
// Adjustment - 30 => - Tabheight needed / - 3 = Bottom Tab = Top Gradient !!!
GradientFill( hDC, - 3, 0, 236 - 30, 380, aGrad1, lDirect ) // Height, Width
DeleteObject( oDlg:oBrush:hBrush )
oBrush := TBrush():New( ,,,, hBmp )
oBrush:Cargo := aGrad1
SelectObject( hDC, hBmpOld )
oDlg:SetBrush( oBrush )
ENDIF
IF n = 2 // Gradient
hBmp = CreateCompatibleBitMap( oDlg:hDC, 380, 236 ) // Width, Height
hBmpOld = SelectObject( hDC, hBmp )
// Adjustment - 30 => - Tabheight needed / - 3 = Bottom Tab = Top Gradient !!!
GradientFill( hDC, - 3, 0, 236 - 30, 380, aGrad2, lDirect ) // Height, Width
DeleteObject( oDlg:oBrush:hBrush )
oBrush := TBrush():New( ,,,, hBmp )
oBrush:Cargo := aGrad2
SelectObject( hDC, hBmpOld )
oDlg:SetBrush( oBrush )
ENDIF
IF n = 3 // Brush
IF !FILE( c_path + "\Images\" + cBrush )
MsgAlert( "File : " + c_path + "\Images\" + cBrush + CRLF + ;
"does not exist to create" + CRLF + ;
"Brush-Background !", "ATTENTION" )
lFound := .F.
ELSE
DEFINE BRUSH oBrush FILENAME c_path + "\Images\" + cBrush
oDlg:SetBrush( oBrush )
ENDIF
ENDIF
IF n = 4 //
IF !FILE( c_path + "\Images\" + cImage )
MsgAlert( "File : " + c_path + "\Images\" + cBrush + CRLF + ;
"does not exist to create" + CRLF + ;
"Image-Background !", "ATTENTION" )
lFound := .F.
ELSE
DEFINE IMAGE oImage FILE c_path + "\Images\" + cImage
oBrush := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap, 364, 220, .T. ) ) // Width, Height
oImage:End()
SET BRUSH OF oDlg TO oBrush
ENDIF
ENDIF
RELEASE BRUSH oBrush
ReleaseDC(hDC)
NEXT
RETURN( NIL )