#include "FiveWin.ch"
FUNCTION Main()
local oDlg, oFont, oFld, oFSay[12], aColors
// SetDlgGradient( { { 1, RGB( 199, 216, 237 ), RGB( 237, 242, 248 ) } } )
aColors := { { 1, RGB( 199, 216, 237 ), RGB( 237, 242, 248 ) } }
SET _3DLOOK ON
DEFINE FONT oFont NAME "Arial" SIZE 0,-12 BOLD
DEFINE DIALOG oDlg TITLE "Test Gradient and SAY on FOLDER" ;
FROM 0,0 TO 420,350 PIXEL ;
FONT oFont // TRANSPARENT
@ 5, 5 FOLDER oFld PROMPT "Test1", "Test2", "Test3", "Test4" ;
OF oDlg SIZE 160,110 PIXEL
@ 5, 5 SAY oFSay[1] PROMPT "Test1" OF oFld:aDialogs[1] PIXEL FONT oFont
@ 20, 5 SAY oFSay[2] PROMPT "Test2 Test2" OF oFld:aDialogs[1] PIXEL FONT oFont
@ 35, 5 SAY oFSay[3] PROMPT "Test3 Test3 Test3" OF oFld:aDialogs[1] PIXEL FONT oFont
@ 50, 5 SAY oFSay[4] PROMPT "Test4 Test4 Test4 Test4" OF oFld:aDialogs[1] PIXEL FONT oFont
@ 65, 5 SAY oFSay[5] PROMPT "Test5 Test5 Test5 Test5 Test5" OF oFld:aDialogs[1] PIXEL FONT oFont
@ 80, 5 SAY oFSay[6] PROMPT "Test6 Test6 Test6 Test6 Test6 Test6" OF oFld:aDialogs[1] PIXEL FONT oFont
SETFOLDGRAD( oFld )
@ 125, 5 SAY oFSay[7] PROMPT "Test1" OF oDlg PIXEL FONT oFont
@ 140, 5 SAY oFSay[8] PROMPT "Test2 Test2" OF oDlg PIXEL FONT oFont
@ 155, 5 SAY oFSay[9] PROMPT "Test3 Test3 Test3" OF oDlg PIXEL FONT oFont
@ 170, 5 SAY oFSay[10] PROMPT "Test4 Test4 Test4 Test4" OF oDlg PIXEL FONT oFont
@ 185, 5 SAY oFSay[11] PROMPT "Test5 Test5 Test5 Test5 Test5" OF oDlg PIXEL FONT oFont
@ 200, 5 SAY oFSay[12] PROMPT "Test6 Test6 Test6 Test6 Test6 Test6" OF oDlg PIXEL FONT oFont
I := 1
FOR I := 1 TO 12
oFSay[I]:lTransparent := .T.
NEXT
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT GradBrush( oDlg, aColors, .T. )
RELEASE FONT oFont
return nil
// --------
FUNCTION SetFoldGrad( oFolder )
LOCAL aGradiate := ARRAY(10), aBrushes := ARRAY(LEN(oFolder:aDialogs))
aGradiate[1] := { {1, RGB( 199, 216, 237 ), RGB( 237, 242, 248 ) }, {1, RGB( 237, 242, 248 ), RGB( 199, 216, 237 ) } }
aGradiate[2] := { {1, CLR_WHITE, nRGB( 222, 214, 225 ) }, {1, nRGB( 222, 214, 225 ), CLR_WHITE } }
aGradiate[3] := { {1, CLR_WHITE, nRGB( 219, 240, 200 ) }, {1, nRGB( 219, 240, 200 ), CLR_WHITE } }
aGradiate[4] := { {1, CLR_WHITE, nRGB( 248, 226, 250 ) }, {1, nRGB( 248, 226, 250 ), CLR_WHITE } }
aGradiate[5] := { {1, CLR_WHITE, nRGB( 233, 235, 218 ) }, {1, nRGB( 233, 235, 218 ), CLR_WHITE } }
aGradiate[6] := { {1, CLR_WHITE, nRGB( 224, 252, 254 ) }, {1, nRGB( 224, 252, 254 ), CLR_WHITE } }
aGradiate[7] := { {1, CLR_WHITE, nRGB( 235, 224, 199 ) }, {1, nRGB( 235, 224, 199 ), CLR_WHITE } }
aGradiate[8] := { {1, CLR_WHITE, nRGB( 237, 255, 221 ) }, {1, nRGB( 237, 255, 221 ), CLR_WHITE } }
aGradiate[9] := { {1, CLR_WHITE, nRGB( 255, 249, 215 ) }, {1, nRGB( 255, 249, 215 ), CLR_WHITE } }
aGradiate[10] := { {1, CLR_WHITE, nRGB( 247, 234, 219 ) }, {1, nRGB( 247, 234, 219 ), CLR_WHITE } }
FOR n = 1 TO LEN(aBrushes)
DEFINE BRUSH aBrushes[n] GRADIENT aGradiate[n]
oFolder:aDialogs[n]:SetBrush(aBrushes[n])
NEXT
RETURN nil
// ----------------
FUNCTION GradBrush( 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