Hey guys,
I would like to know if the gradient generated by the setdlggrandient function can be horizontal?
regards
SetDlgGradient( { { 0.6, CLR_BLUE, CLR_WHITE }, { 0.4, CLR_WHITE, CLR_BLUE }, .F. } )
// C:\FWH..\SAMPLES\GRADHOR2.PRG
#include "fivewin.ch"
FUNCTION Main()
LOCAL oDlg, aGrad, oBrush, oBrush1, oBrush2
aGrad := { { 0.4, CLR_GREEN, CLR_HGREEN }, ;
{ 0.6, CLR_HGREEN, CLR_GREEN } }
DEFINE BRUSH oBrush GRADIENT aGrad STYLE HORIZONTAL // or VERTICAL
DEFINE BRUSH oBrush1 COLOR nRGB( 250, 213, 174 ) STYLE HORIZONTAL
DEFINE BRUSH oBrush2 COLOR nRGB( 192, 192, 192 ) STYLE HORIZONTAL
DEFINE DIALOG oDlg TITLE "- Gradient Horizontal -" SIZE 350, 350 ;
PIXEL TRUEPIXEL RESIZABLE BRUSH oBrush // OR GRADIENT aGrad
oDlg:lhelpIcon := .F.
ACTIVATE DIALOG oDlg CENTERED
RELEASE BRUSH oBrush
RETURN NIL
// FIN / END
//-------------------
Func GreyButtonGrad()
// 2010 grey button skin
Local bGrad
bGrad := { | lInvert | If( ! lInvert, ;
{ { 1, nRGB( 255, 255, 255 ), nRGB( 207, 207, 207 ) } }, ;
{ { 1/3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
{ 2/3, nRGB( 255, 215, 84 ), nRGB( 255, 233, 162 ) } } ) }
Return( bGrad )
//---------------------------
Func BlueGreenGrad()
Local xGrad4 := {{ 1.00,14671839, 7419904 }, { 1.00,7419904, 14671839 }} // med blue
SetDlgGradient( xGrad4 )
Return(nil)
//---------------------
Func SolidGreenBlue()
SetDlgGradient({ { 0.01,9994298,9994298 },{ 0.01,9994298,9994298 } })
Return(nil)
//-------------
Func SolidDarkBlue()
SetDlgGradient( { { 0.50,4720905,4720905 },{ 0.50,4720905,4720905 } })
Return(nil)
//-------------------
Func SolidBlue()
SetDlgGradient( { { 0.01,16711680,16711680 },{ 0.01,16711680,16711680 } })
Return(nil)
//------------------
Func DarkBlueGrad()
SetDlgGradient({ { 0.0,8388608,13619151 },{ 0.0,13619151,8388608 } })
Return(nil)
//--------------
Func LightGreenGrad()
SetDlgGradient( { { .50, nRGB(210,235,216), nRGB( 255, 255, 255 ) } } )
Return(nil)
//------------------
Func LightBlueGrad()
SetDlgGradient( { { .50, nRGB( 201, 217, 237 ), nRGB( 231, 242, 255 ) } } )
Return(nil)
//------------------
Func LightGreyGrad()
SetDlgGradient( { { .50, nRGB( 216, 216, 216 ), nRGB( 255, 255, 255 ) } } )
Return(nil)
//-----------------
Func StandardGrad()
SetDlgGradient( { { .50, nRGB( 236, 233, 216 ), nRGB( 255, 255, 255 ) } } )
Return(nil)
//--------------------
Func DarkGreyGrad()
SetDlgGradient({{ 0.90, 14671839, 4144959 },{ 0.1, 4144959, 14671839 }}) // .80
Return(nil)
//------------------------------------
Func SolidWhite()
SetDlgGradient( { { 0.01,16777215,16777215 },{ 0.01,16777215,16777215 } })
Return(nil)
//--------------------
Func SolidGrey()
SetDlgGradient( { { .50, nRGB( 233, 233, 233 ), nRGB( 233, 233, 233 ) } } )
Return(nil)
//--------------------
Func SolidChoral()
SetDlgGradient(aGrad := { { 0.01,8388736,8388736 },{ 0.01,8388736,8388736 } })
Return(nil)
//-----------------
Func LightYellow()
SetDlgGradient( { { 0.01,8440801,16777215 },{ 0.75,16777215,8440801 } })
Return(nil)
//-------------------
Func GreenBlueGrad()
SetDlgGradient( { { .50, nRGB( 192, 192, 192 ), nRGB( 45, 121, 147 ) } } )
Return(nil)
I have put several of my gradients into functions .. very easy to use ...
// C:\FWH..\SAMPLES\GRADHOR3.PRG
#include "FiveWin.ch"
#define CLR_MSPURPLE RGB( 0, 120, 215 )
#define CLR_MSRED RGB( 232, 17, 35 )
#define CLR_MSGRAY RGB( 229, 229, 229 )
FUNCTION FitcadExe() // (tip_fun)
LOCAL itcadexe, oFont
LOCAL lsalva := .F.
LOCAL ncodexe, cdesexe, ocodexe, odesexe
LOCAL oBtn2_itcadexe, oBtn8_itcadexe
LOCAL oCursorBtn := TCursor():New(, 'HAND' )
nCodexe := Space( 04 )
cDesexe := Space( 50 )
DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 00, -16 // BOLD
DEFINE DIALOG itcadexe FROM 0, 0 TO 216, 513 TITLE 'Gradient Example' ;
PIXEL TRANSPARENT FONT oFont STYLE nOR( DS_MODALFRAME, WS_POPUP, ;
WS_CAPTION, WS_SYSMENU, WS_MINIMIZEBOX )
itcadexe:lhelpIcon := .F.
@ 20, 3 SAY "Codigo do exemplo:" SIZE 86, 10 PIXEL OF itcadexe UPDATE ;
COLOR CLR_WHITE, CLR_BLACK
@ 33, 3 SAY "Descricao do exemplo:" SIZE 86, 10 PIXEL OF itcadexe UPDATE ;
COLOR CLR_WHITE, CLR_BLACK
IF Set( _SET_INSERT, ! Set( _SET_INSERT ) )
Set( _SET_INSERT, ! Set( _SET_INSERT ) )
ENDIF
@ 19, 89 GET ocodexe VAR ncodexe SIZE 24, 12 PIXEL OF itcadexe ;
READONLY UPDATE COLOR CLR_MSPURPLE, CLR_BLACK
ocodexe:lBtnTransparent := .T. // transparent button get oGet3
ocodexe:lAdjustBtn := .T. // Button Get Adjust Witdh oGet3
ocodexe:lDisColors := .F. // Deactive disable color
ocodexe:nClrTextDis := CLR_WHITE // Color text disable status
ocodexe:nClrPaneDis := CLR_BLUE // Color Pane disable status
@ 32, 89 GET odesexe VAR cdesexe SIZE 162, 12 PIXEL OF itcadexe ;
PICTURE "@!" UPDATE COLOR CLR_MSPURPLE, CLR_BLACK
@ 70, 76 BTNBMP oBtn2_itcadexe PROMPT "Confirma" FLAT 2007 CENTER UPDATE ;
OF itcadexe PIXEL SIZE 42, 35 action ( lsalva := .T., itcadexe:end() )
oBtn2_itcadexe:lCancel := .T.
oBtn2_itcadexe:nClrBorder := iif( oBtn2_itcadexe:lMOver, RGB( 219, 230, 244 ), RGB( 219, 230, 244 ) )
oBtn2_itcadexe:oCursor := oCursorBtn
@ 70, 138 BTNBMP oBtn8_itcadexe PROMPT "Voltar" FLAT 2007 CENTER UPDATE ;
OF itcadexe PIXEL SIZE 42, 35 action ( lsalva := .F., itcadexe:end() )
oBtn8_itcadexe:lCancel := .T.
// Rick
oBtn8_itcadexe:bClrGrad := { | lInvert | If( ! lInvert, ;
{ { 1, nRGB( 255, 255, 255 ), nRGB( 207, 207, 207 ) } }, ;
{ { 1/3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
{ 2/3, nRGB( 255, 215, 84 ), nRGB( 255, 233, 162 ) } } ) }
oBtn8_itcadexe:nClrBorder := iif( oBtn8_itcadexe:lMOver, RGB( 219, 230, 244 ), RGB( 219, 230, 244 ) )
oBtn8_itcadexe:oCursor := oCursorBtn
tGradtela( itcadexe, ( 46 ) ) // GRADIENT
ACTIVATE DIALOG itcadexe CENTERED
IF Set( _SET_INSERT, ! Set( _SET_INSERT ) )
Set( _SET_INSERT, ! Set( _SET_INSERT ) )
ENDIF
oFont:End()
RETURN NIL
FUNCTION tGradtela( par_obj, par_percent )
LOCAL naltura_BTN := par_percent * 2
LOCAL npercent_par_obj := Round( ( naltura_BTN / par_obj:nHeight ), 2 )
par_obj:aGradcolors := { { ( 1 - npercent_par_obj ), nRGB( 110, 193, 248 ), nRGB( 0, 64, 254 ) }, ;
{ npercent_par_obj, nRGB( 255, 255, 255 ), nRGB( 255, 255, 255 ) } }
RETURN .T.
Function GreyButtonGrad()
// 2010 grey button skin
Local bGrad
bGrad := { | lInvert | If( ! lInvert, ;
{ { 1, nRGB( 255, 255, 255 ), nRGB( 207, 207, 207 ) } }, ;
{ { 1/3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
{ 2/3, nRGB( 255, 215, 84 ), nRGB( 255, 233, 162 ) } } ) }
Return( bGrad )
// FIN / END - kapiabafwh@gmail.com
REDEFINE BTNBMP oBtn2 ID 251 of oGrps ; // cancel
RESOURCE "CANCEL" ;
PROMPT "&Cancel" LEFT 2007;
ACTION( loK := .F., oGrps:END() ) ;
GRADIENT GreyButtonGrad()
oButt2:lCancel := .t.
//-----------------
Func GreyButtonGrad()
// 2010 grey button skin
Local bGrad
bGrad := { | lInvert | If( ! lInvert, ;
{ { 1, nRGB( 255, 255, 255 ), nRGB( 207, 207, 207 ) } }, ;
{ { 1/3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
{ 2/3, nRGB( 255, 215, 84 ), nRGB( 255, 233, 162 ) } } ) }
Return( bGrad )
DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 00, -16 // BOLD
//--- rick added gradient here
LightGreyGrad()
SetGetColorFocus( rgb(209,224,252) ) // color for gets
DEFINE DIALOG itcadexe FROM 0, 0 TO 216, 513 TITLE 'Gradient Example' ;
PIXEL TRANSPARENT FONT oFont STYLE nOR( DS_MODALFRAME, WS_POPUP, ;
WS_CAPTION, WS_SYSMENU, WS_MINIMIZEBOX )
// C:\FWH..\SAMPLES\GRADHOR3.PRG
#include "FiveWin.ch"
#define CLR_MSPURPLE RGB( 0, 120, 215 )
#define CLR_MSRED RGB( 232, 17, 35 )
#define CLR_MSGRAY RGB( 229, 229, 229 )
FUNCTION FitcadExe() // (tip_fun)
LOCAL itcadexe, oFont
LOCAL lsalva := .F.
LOCAL ncodexe, cdesexe, ocodexe, odesexe
LOCAL oBtn2_itcadexe, oBtn8_itcadexe
LOCAL oCursorBtn := TCursor():New(, 'HAND' )
nCodexe := Space( 04 )
cDesexe := Space( 50 )
DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 00, -16 // BOLD
//--- rick added gradient here
// LightGreyGrad() // NO ME GUSTA
// BlueGreenGrad() // BIEN / GOOD
SolidGreenBlue() // BIEN / GOOD
SetGetColorFocus( RGB( 209, 224, 252 ) ) // color for gets
DEFINE DIALOG itcadexe FROM 0, 0 TO 216, 513 TITLE 'Gradient Example' ;
PIXEL TRANSPARENT FONT oFont STYLE nOR( DS_MODALFRAME, WS_POPUP, ;
WS_CAPTION, WS_SYSMENU, WS_MINIMIZEBOX )
itcadexe:lhelpIcon := .F.
@ 20, 3 SAY "Codigo do exemplo:" SIZE 86, 10 PIXEL OF itcadexe UPDATE ;
COLOR CLR_WHITE, CLR_BLACK
@ 33, 3 SAY "Descricao do exemplo:" SIZE 86, 10 PIXEL OF itcadexe UPDATE ;
COLOR CLR_WHITE, CLR_BLACK
IF Set( _SET_INSERT, ! Set( _SET_INSERT ) )
Set( _SET_INSERT, ! Set( _SET_INSERT ) )
ENDIF
@ 19, 89 GET ocodexe VAR ncodexe SIZE 24, 12 PIXEL OF itcadexe ;
READONLY UPDATE COLOR CLR_MSPURPLE, CLR_BLACK
ocodexe:lBtnTransparent := .T. // transparent button get oGet3
ocodexe:lAdjustBtn := .T. // Button Get Adjust Witdh oGet3
ocodexe:lDisColors := .F. // Deactive disable color
ocodexe:nClrTextDis := CLR_WHITE // Color text disable status
ocodexe:nClrPaneDis := CLR_BLUE // Color Pane disable status
@ 32, 89 GET odesexe VAR cdesexe SIZE 162, 12 PIXEL OF itcadexe ;
PICTURE "@!" UPDATE COLOR CLR_MSPURPLE, CLR_BLACK
@ 70, 76 BTNBMP oBtn2_itcadexe PROMPT "Confirma" FLAT 2007 CENTER UPDATE ;
OF itcadexe PIXEL SIZE 42, 35 action ( lsalva := .T., itcadexe:end() ) ;
GRADIENT LightGreyGrad() // No funciona.
oBtn2_itcadexe:lCancel := .T.
oBtn2_itcadexe:nClrBorder := iif( oBtn2_itcadexe:lMOver, RGB( 219, 230, 244 ), RGB( 219, 230, 244 ) )
oBtn2_itcadexe:oCursor := oCursorBtn
@ 70, 138 BTNBMP oBtn8_itcadexe PROMPT "Voltar" FLAT 2007 CENTER UPDATE ;
OF itcadexe PIXEL SIZE 42, 35 action ( lsalva := .F., itcadexe:end() ) ;
GRADIENT DarkBlueGrad() // no funciona // LightGreyGrad() // No funciona
oBtn8_itcadexe:lCancel := .T.
// Rick Enabled
/*
oBtn8_itcadexe:bClrGrad := { | lInvert | If( ! lInvert, ;
{ { 1, nRGB( 255, 255, 255 ), nRGB( 207, 207, 207 ) } }, ;
{ { 1/3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
{ 2/3, nRGB( 255, 215, 84 ), nRGB( 255, 233, 162 ) } } ) }
*/
oBtn8_itcadexe:nClrBorder := iif( oBtn8_itcadexe:lMOver, RGB( 219, 230, 244 ), RGB( 219, 230, 244 ) )
oBtn8_itcadexe:oCursor := oCursorBtn
// Enable for Rick
// tGradtela( itcadexe, ( 46 ) ) // GRADIENT
ACTIVATE DIALOG itcadexe CENTERED
IF Set( _SET_INSERT, ! Set( _SET_INSERT ) )
Set( _SET_INSERT, ! Set( _SET_INSERT ) )
ENDIF
oFont:End()
RETURN NIL
FUNCTION tGradtela( par_obj, par_percent )
LOCAL naltura_BTN := par_percent * 2
LOCAL npercent_par_obj := Round( ( naltura_BTN / par_obj:nHeight ), 2 )
par_obj:aGradcolors := { { ( 1 - npercent_par_obj ), nRGB( 110, 193, 248 ), nRGB( 0, 64, 254 ) }, ;
{ npercent_par_obj, nRGB( 255, 255, 255 ), nRGB( 255, 255, 255 ) } }
RETURN .T.
FUNCTION GreyButtonGrad()
// 2010 grey button skin
LOCAL bGrad
bGrad := { | lInvert | If( ! lInvert, ;
{ { 1, nRGB( 255, 255, 255 ), nRGB( 207, 207, 207 ) } }, ;
{ { 1/3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
{ 2/3, nRGB( 255, 215, 84 ), nRGB( 255, 233, 162 ) } } ) }
RETURN( bGrad )
FUNCTION BlueGreenGrad()
LOCAL xGrad4 := {{ 1.00, 14671839, 7419904 }, { 1.00,7419904, 14671839 }} // med blue
SetDlgGradient( xGrad4 )
RETURN NIL
FUNCTION SolidGreenBlue()
SetDlgGradient({ { 0.01, 9994298, 9994298 },{ 0.01, 9994298, 9994298 } })
RETURN NIL
FUNCTION SolidDarkBlue()
SetDlgGradient( { { 0.50,4720905,4720905 },{ 0.50,4720905,4720905 } })
RETURN NIL
FUNCTION SolidBlue()
SetDlgGradient( { { 0.01,16711680,16711680 },{ 0.01,16711680,16711680 } })
RETURN NIL
FUNCTION DarkBlueGrad()
SetDlgGradient({ { 0.0, 8388608, 13619151 },{ 0.0, 13619151, 8388608 } })
RETURN NIL
FUNCTION LightGreenGrad()
SetDlgGradient( { { .50, nRGB(210,235,216), nRGB( 255, 255, 255 ) } } )
RETURN NIL
FUNCTION LightBlueGrad()
SetDlgGradient( { { .50, nRGB( 201, 217, 237 ), nRGB( 231, 242, 255 ) } } )
RETURN NIL
FUNCTION LightGreyGrad()
SetDlgGradient( { { .50, nRGB( 216, 216, 216 ), nRGB( 255, 255, 255 ) } } )
RETURN NIL
FUNCTION StandardGrad()
SetDlgGradient( { { .50, nRGB( 236, 233, 216 ), nRGB( 255, 255, 255 ) } } )
RETURN NIL
FUNCTION DarkGreyGrad()
SetDlgGradient({{ 0.90, 14671839, 4144959 },{ 0.1, 4144959, 14671839 }}) // .80
RETURN NIL
FUNCTION SolidWhite()
SetDlgGradient( { { 0.01,16777215,16777215 },{ 0.01,16777215,16777215 } })
RETURN NIL
FUNCTION SolidGrey()
SetDlgGradient( { { .50, nRGB( 233, 233, 233 ), nRGB( 233, 233, 233 ) } } )
RETURN NIL
FUNCTION SolidChoral()
LOCAL aGrad
SetDlgGradient( aGrad := { { 0.01,8388736,8388736 },{ 0.01,8388736,8388736 } })
RETURN NIL
FUNCTION LightYellow()
SetDlgGradient( { { 0.01,8440801,16777215 },{ 0.75,16777215,8440801 } })
RETURN NIL
FUNCTION GreenBlueGrad()
SetDlgGradient( { { .50, nRGB( 192, 192, 192 ), nRGB( 45, 121, 147 ) } } )
RETURN NIL
// FIN / END - kapiabafwh@gmail.com
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 88 guests