Remember SetDlgGradient is GLOBAL !!!
Define a extra dialog-style using global
SetDlgGradientFUNCTION MAIN()
local oDlg1, oBtn1, oBtn2
SetDlgGradient( { { 1, RGB( 199, 216, 237 ), RGB( 237, 242, 248 ) } } )DEFINE DIALOG oDlg1 FROM 50, 50 TO 300, 400 ;
TITLE "Dialog using SetDlgGradient" PIXEL TRANSPARENT
@ 35, 40 BUTTON oBtn1 PROMPT "&Next" SIZE 40, 20 OF oDlg1 PIXEL ;
ACTION DIALOG2()
@ 35, 100 BUTTON oBtn2 PROMPT "&Quit" SIZE 40, 20 OF oDlg1 PIXEL ;
ACTION oDlg1:End()
ACTIVATE DIALOG oDlg1 ;
ON INIT oDlg1:Move(50, 50)
RETURN NIL
// -----------------------------
FUNCTION DIALOG2()
local oDlg2, oBtn1, oBtn2
SetDlgGradient() // Disabled
DEFINE DIALOG oDlg2 FROM 50, 50 TO 300, 400 ;
TITLE "A EXTRA Dialog-background" PIXEL TRANSPARENT
@ 35, 40 BUTTON oBtn1 PROMPT "&Next" SIZE 40, 20 OF oDlg2 PIXEL ;
ACTION (
SetDlgGradient( { { 1, RGB( 199, 216, 237 ), RGB( 237, 242, 248 ) } } ), ;
DIALOG3() )
@ 35, 100 BUTTON oBtn2 PROMPT "&Quit" SIZE 40, 20 OF oDlg2 PIXEL ;
ACTION oDlg2:End()
ACTIVATE DIALOG oDlg2 ;
ON INIT (
DLG_BACK( oDlg2, .T., 16038911, 16777215, 0.5 ), ; oDlg2:Move( 150,150 ) )
// Enable
SetDlgGradient( { { 1, RGB( 199, 216, 237 ), RGB( 237, 242, 248 ) } } )RETURN NIL
// -----------------------------
FUNCTION DIALOG3()
local oDlg3, oBtn1
DEFINE DIALOG oDlg3 FROM 150, 150 TO 400, 600 ;
TITLE "Back to => SetDlgGradient" PIXEL TRANSPARENT
@ 35, 60 BUTTON oBtn1 PROMPT "&Quit" SIZE 40, 20 OF oDlg3 PIXEL ;
ACTION oDlg3:End()
ACTIVATE DIALOG oDlg3 ;
ON INIT oDlg3:Move(250, 250)
RETURN NIL
// --------
FUNCTION DLG_BACK( oWnd, lDirect, nColor1,
nColor2, nMove )
local oBrush
aGrad := { { nMove, nColor1,
nColor2 }, { nMove,
nColor2, nColor1 } }
hDC = CreateCompatibleDC( oWnd:GetDC() )
hBmp = CreateCompatibleBitMap( oWnd:hDC, oWnd:nWidth, oWnd:nHeight )
hBmpOld = SelectObject( hDC, hBmp )
GradientFill( hDC, 0, 0, oWnd:nHeight, oWnd:nWidth, aGrad, lDirect ) // .T. = Vertical
DeleteObject( oWnd:oBrush:hBrush )
oBrush := TBrush():New( ,,,, hBmp )
oBrush:Cargo := aGrad
SelectObject( hDC, hBmpOld )
ReleaseDC(hDC)
oWnd:SetBrush( oBrush )
oBrush:End()
RETURN( NIL )
Best Regards
Uwe