estou tentando colocar DEGRADE no folder mais só funciona com o ON PAINT, num funciona no ON INIT, e outra coisa é possivel o LABEL ficar TRANSPARENTE
- Code: Select all Expand view
#include "FiveWin.ch"
#include "FWCE.ch"
function Main()
local oWnd, cValue, cText := "Hello world!", oLbx
DEFINE WINDOW oWnd TITLE "Folders"
USE ( CurDir() + "\Customer" )
oLbx := TWBrowse():New( 100, 100 )
oLbx:End()
@ 0.5, 1 FOLDER oFld PROMPTS "One", "Two", "Three" ;
DIALOGS "sub1", "sub2", "sub3" ;
SIZE 225, 245
REDEFINE COMBOBOX cValue ID 100 OF oFld:aDialogs[ 1 ] ;
ITEMS { "Red", "Green", "Blue" }
REDEFINE BUTTON ID 110 OF oFld:aDialogs[ 1 ] ACTION MsgInfo( "click" )
REDEFINE BUTTON ID 120 OF oFld:aDialogs[ 1 ] ACTION MsgInfo( cValue )
REDEFINE BUTTON ID 104 OF oFld:aDialogs[ 2 ] ACTION MsgInfo( "Second dialog" )
REDEFINE GET cText ID 106 OF oFld:aDialogs[ 2 ] COLOR "GR+/G"
REDEFINE LISTBOX oLbx FIELDS First, Last ID 10 OF oFld:aDialogs[ 3 ]
oFld:InitDialogs() // required to initialize the resources dialogs !
ACTIVATE WINDOW oWnd ON PAINT (oFld:aDialogs[03]:bPainted:={||PintaTela( oFld:aDialogs[03],CLR_GREEN , CLR_RED) },;
oFld:aDialogs[01]:bPainted:={||PintaTela( oFld:aDialogs[01],CLR_HBLUE , CLR_BLACK) } )
return nil
**-----------------------------------------------------------------------------------------------------------**
** Pintar o fundo de uma tela( Dlg,Folder,Wnd) **
**-----------------------------------------------------------------------------------------------------------**
** Parametros : oDlg : Onde vai pintar **
** : Cor1 : Cor incial na parte de cima da tela **
** : Cor2 : Cor Final na parte de baixo da tela **
** Exemplo : oDlg[1]:bPainted:={|| PintaTela(oDlg[1],GetSysColor(15),GetSysColor(16) )} **
**-----------------------------------------------------------------------------------------------------------**
FUNCTION PintaTela(oDlgTxt,aCor1,aCor2)
LOCAL hWnd:=oDlgTxt:hWnd
LOCAL aRec:=GetClientRect(hWnd)
LOCAL oBrush,nX,nStp:=(aRec[3]-aRec[1])/2
LOCAL nColor1:=IF(Empty(aCor1),GetSysColor(15),aCor1)
LOCAL nColor2:=IF(Empty(aCor2),GetSysColor(15),aCor2)
LOCAL nColorR1:=nRgbRed(nColor1),nColorG1:=nRgbGreen(nColor1),nColorB1:=nRgbBlue(nColor1)
LOCAL nColorR2:=nRgbRed(nColor2),nColorG2:=nRgbGreen(nColor2),nColorB2:=nRgbBlue(nColor2)
LOCAL nSomaR:=ABS(nColorR2-nColorR1),nSomaG:=ABS(nColorG2-nColorG1),nSomaB:=ABS(nColorB2-nColorB1)
nSomaR:=IIF(nSomaR<0,0,(nSomaR/((aRec[3])/2)))
nSomaG:=IIF(nSomaG<0,0,(nSomaG/((aRec[3])/2)))
nSomaB:=IIF(nSomaB<0,0,(nSomaB/((aRec[3])/2)))
oDlgTxt:GetDC()
aRec[3]:=0
FOR nX:=1 TO nStp
aRec[3]+=2
DEFINE BRUSH oBrush COLOR nRgb(nColorR1,nColorG1,nColorB1)
FillRect(oDlgTxt:hDC,aRec,oBrush:hBrush)
RELEASE BRUSH oBrush
aRec[1]+=2
nColorR1:=IIF(nColorR2>=nColorR1,nColorR1+nSomaR,nColorR1-nSomaR)
nColorG1:=IIF(nColorG2>=nColorG1,nColorG1+nSomaG,nColorG1-nSomaG)
nColorB1:=IIF(nColorB2>=nColorB1,nColorB1+nSomaB,nColorB1-nSomaB)
NEXT
oDlgTxt:ReleaseDC()
RETURN(NIL)
veja este codigo só funciona se eu ir e voltar pro folder
Fico no aguardo