I wanted to use the function GradientBrush for a transparent Tab-display
in folders. As long I use a color or a tiled background, there is no problem.
With a gradient it shows, the color of the tab-area is not equal with the dialog.
A test-gradient ( direction use .F. = vertical )
aGrad := { { 0.95,8388608,16777215 },{ 0.95,16777215,8388608 } }
Like You can see :
the calculation to replace the color of the tab-area, starts with the left side of the folder
uses the left start-color of the dialog.
Is it possible, to fix this ?
The same with a Horizontal gradient. The transparent tab-area of the folder must be white
but uses the blue from top of the dialog.
- Code: Select all Expand view
...
ACTIVATE DIALOG oDlg5 CENTERED ;
ON INIT DLG_GRAD( oDlg )
// ---------- Dialog - Gradient -------------------
FUNCTION DLG_GRAD( oDlg )
// D_DIRECT = Horizontal or Vertical
// D_MOVE = Color-Position
// D_COLOR1 = 1. Gradient-Color
// D_COLOR2 = 2. Gradient-Color
IF D_DIRECT = 1 // Gradient direction
GradientBrush( oDlg, { { D_MOVE, D_COLOR1, D_COLOR2 }, ;
{ D_MOVE, D_COLOR2, D_COLOR1 } }, .T. )
ELSE
GradientBrush( oDlg, { { D_MOVE, D_COLOR1, D_COLOR2 }, ;
{ D_MOVE, D_COLOR2, D_COLOR1 } }, .F. )
ENDIF
RETURN( NIL )
// --------------------------------
FUNCTION GradientBrush( oDlg, aColors, lPos )
local hDC, hBmp, hBmpOld, oBrush
if Empty( oDlg:oBrush:hBitmap )
hDC = CreateCompatibleDC( oDlg:GetDC() )
hBmp = CreateCompatibleBitMap( oDlg:hDC, oDlg:nWidth, oDlg:nHeight )
hBmpOld = SelectObject( hDC, hBmp )
GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, aColors, lPos )
DeleteObject( oDlg:oBrush:hBrush )
oDlg:oBrush:hBitmap = hBmp
oDlg:oBrush:hBrush = CreatePatternBrush( hBmp )
SelectObject( hDC, hBmpOld )
oDlg:ReleaseDC()
endif
RETURN NIL
Best Regards
Uwe