#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg, oSay
DEFINE DIALOG oDlg;
TRANSPARENT
// @ 1, 1 BUTTON "Test";
// ACTION ( oSay:SetColor( CLR_HGREEN, CLR_HRED ),;
// oSay:Refresh() )
@ 1, 1 BUTTON "Test";
ACTION ( oDlg:bPainted:={|| oSay:SetColor( CLR_HGREEN, CLR_HRED ),;
oSay:Refresh() }, oDlg:refresh() )
@ 3, 1 SAY oSay PROMPT "This is a test"
oSay:lTransparent = .F.
//oDlg:bStart = { || oSay:SetColor( CLR_HRED, CLR_HGREEN ), oSay:Refresh() }
oDlg:bPainted = { || oSay:SetColor( CLR_HRED, CLR_HGREEN ), oSay:Refresh() }
ACTIVATE DIALOG oDlg;
ON INIT GRADIENTBRUSH( oDlg, { { 1, RGB( 216, 230, 238 ), RGB( 103, 154, 194 ) } } );
CENTER
RETURN NIL
FUNCTION GRADIENTBRUSH( oDlg, aColors )
LOCAL hDC, hBmp, hBmpOld, oBrush
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 )
oBrush = TBrush():New( ,,,, hBmp )
oDlg:SetBrush( oBrush )
AEVAL( oDlg:aControls, { | oCtl | If( oCtl:lTransparent, oCtl:SetBrush( oDlg:oBrush ), ) } )
RELEASE BRUSH oBrush
SELECTOBJECT( hDC, hBmpOld )
DELETEDC( hDC )
oDlg:ReleaseDC()
RETURN NIL