- Code: Select all Expand view
- #include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg
LOCAL lVar := .F.
DEFINE DIALOG oDlg;
TRANSPARENT
@ 1, 1 BUTTON "Test";
ACTION TEST()
@ 3, 1 CHECKBOX lVar
ACTIVATE DIALOG oDlg;
ON INIT GRADIENTBRUSH( oDlg, { { 1, RGB( 216, 230, 238 ), RGB( 103, 154, 194 ) } } );
CENTER
RETURN NIL
FUNCTION TEST()
LOCAL oDlg
DEFINE DIALOG oDlg;
TRANSPARENT
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
EMG