by ukoenig » Wed Mar 11, 2015 12:02 am
Christiano,
a sample :
Changes the 1. color and use oBtn[1]:Refresh()
nBColorF1 = 1. color
nBColorB1 = 2. color
nBGradPos1 = Gradient-pos
on Focus-color
nBColorF2 = 1. color
nBColorB2 = 2. color
nBGradPos2 = Gradient-pos
4 same colors = plain color NO gradient
define the colors from any function and use oBtn[1]:Refresh()
BITMAP shows the selected color nBColorF1 :
REDEFINE BITMAP oBMP[1] FILENAME NIL OF oDlg5 ;
ID 110 PIXEL ADJUST BORDER
oBMP[1]:cTooltip := "1. Color"
oBMP[1]:bPainted := { |hDC| BMP_COLOR( oBmp[1], hDC, nBColorF1 ) }
REDEFINE BTNBMP oBtn[1] OF oDlg5 ;
ID 120 PIXEL 2007 ;
NOBORDER ;
PROMPT "&1. Button-" + CRLF + "color" ;
FILENAME c_Pfad1 + "Paint1.Bmp" ;
ACTION ( nBColorF1 := ChooseColor(), oBmp[1]:Refresh(), oBtn[1]:Refresh() ) ;
FONT oFontSys ;
LEFT
oBtn[1]:bClrGrad := { | lMouseOver | If( ! lMouseOver,;
{ { nBGradPos1, nBColorF1, nBColorB1 }, ;
{ nBGradPos1, nBColorB1, nBColorF1 } }, ;
{ { nBGradPos2, nBColorF2, nBColorB2 }, ;
{ nBGradPos2, nBColorB2, nBColorF2 } } ) }
oBtn[1]:lTransparent := .t.
oBtn[1]:cToolTip = { "1. Btn-color" + CRLF + "Color","Color-Selection", 1, CLR_BLACK, 14089979 }
oBtn[1]:SetColor( 0, )
//------------- BMP-Brush shows the selected color -----------
FUNCTION BMP_COLOR( oBitmap, hDC, nColor )
LOCAL aRect := GETCLIENTRECT( oBitmap:hWnd )
LOCAL oBrush
DEFINE BRUSH oBrush COLOR nColor
FillRect( oBitmap:hDC, aRect, oBrush:hBrush )
oBrush:End()
RETURN( NIL )
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.