Silvio, tell me where I'm going wrong now, please.
Code: Select all | Expand
// C:\FWH/SAMPLES\SILVBTN3.PRG
#include "FiveWin.ch"
/*
#Define aPubGrad {| lInvert | If( lInvert, ;
{ { 1 / 3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
{ 2 / 3, nRGB( 255, 215, 84 ), nRGB( 255, 233, 162 ) } ;
}, ;
{ { 1 / 2, nRGB( 219, 230, 244 ), nRGB( 207 - 50, 221 - 25, 255 ) }, ;
{ 1 / 2, nRGB( 201 - 50, 217 - 25, 255 ), nRGB( 231, 242, 255 ) } ;
} ) }
*/
FUNCTION Main()
LOCAL oDlg, oFont, oBold, oBmp, cTitle
LOCAL oCursorBtn := TCursor():New(, 'HAND' )
LOCAL oBtn := Array( 5 )
LOCAL nWd := GetSysMetrics( 0 ) * .58
LOCAL nHt := ( GetSysMetrics( 1 ) / 2 ) - 20
SkinButtons()
cTitle := "Test: BTNBMP Evolution"
DEFINE FONT oFont NAME 'Tahoma' SIZE 0, - 14
DEFINE FONT oBold NAME 'Tahoma' SIZE 0, - 16 BOLD
DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL FONT oFont TRANSPARENT ;
STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
WS_MINIMIZEBOX ) COLOR CLR_BLACK, RGB( 245, 245, 235 ) ;
TITLE cTitle
@ 10, 30 BTNBMP oBtn[ 1 ] PROMPT "&Add" LEFT 2007 FONT oBold ;
FILENAME "..\bitmaps\16x16\floppy.bmp" ;
SIZE 45, 14 PIXEL FLAT NOROUND NOBORDER GDIP OF oDlg ;
COLOR CLR_BLACK, CLR_WHITE ACTION NIL
// oBtn[1]:bClrGrad := aPubGrad // 1 ejemplo mi gusto personal.
// oBtn[1]:bClrGrad := { |lInvert| If( lInvert, 0x60FFA54A, nARGB( 64, 0, 192, 0 ) ) }
oBtn[ 1 ]:bClrGrad := {| lPressed | If( ! lPressed, ;
{ { 1, RGB( 250, 250, 245 ), RGB( 250, 250, 245 ) } }, ;
{ { 1, RGB( 245, 245, 235 ), RGB( 245, 245, 235 ) } } ) }
/*
WITH OBJECT oBtn[1]
:nClrBorder := RGB( 195, 195, 185 )
END
*/
oBtn[ 1 ]:oCursor := oCursorBtn
oBtn[ 1 ]:lTransparent := .T.
@ 30, 30 BTNBMP oBtn[ 2 ] PROMPT "&Exit" LEFT 2007 FONT oBold ;
FILENAME "..\bitmaps\16x16\Exit.bmp" ;
SIZE 45, 14 PIXEL FLAT NOROUND NOBORDER GDIP OF oDlg ;
ACTION( oDlg:End() ) COLOR CLR_BLACK, CLR_WHITE
// oBtn[2]:bClrGrad := aPubGrad // 1 ejemplo a gusto.
// oBtn[2]:bClrGrad := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) }
oBtn[ 2 ]:bClrGrad := {| lPressed | If( ! lPressed, ;
{ { 1, RGB( 250, 250, 245 ), RGB( 250, 250, 245 ) } }, ;
{ { 1, RGB( 245, 245, 235 ), RGB( 245, 245, 235 ) } } ) }
/*
WITH OBJECT oBtn[2]
:nClrBorder := RGB( 195, 195, 185 )
END
*/
oBtn[ 2 ]:oCursor := oCursorBtn
oBtn[ 2 ]:lTransparent := .T.
oBtn[ 2 ]:lCancel := .T.
@ 50, 30 BTNBMP oBtn[ 3 ] PROMPT "&Print" LEFT 2007 FONT oBold ;
FILENAME "..\bitmaps\16x16\printer.bmp" ;
SIZE 45, 14 PIXEL FLAT NOROUND NOBORDER GDIP OF oDlg ;
ACTION( oDlg:End() ) COLOR CLR_BLACK, CLR_WHITE
// oBtn[3]:bClrGrad := aPubGrad // 1 ejemplo a gusto.
// oBtn[3]:bClrGrad := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) }
// oBtn[3]:bClrGrad := { |lInvert| If( lInvert, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) ) }
oBtn[ 3 ]:bClrGrad := {| lPressed | If( ! lPressed, ;
{ { 1, RGB( 250, 250, 245 ), RGB( 250, 250, 245 ) } }, ;
{ { 1, RGB( 245, 245, 235 ), RGB( 245, 245, 235 ) } } ) }
/*
WITH OBJECT oBtn[3]
:nClrBorder := RGB( 195, 195, 185 )
END
*/
oBtn[ 3 ]:oCursor := oCursorBtn
oBtn[ 3 ]:lTransparent := .T.
oBtn[ 3 ]:lBoxSelect := .F.
oBtn[ 3 ]:lEllipse = .T.
DEFINE BITMAP oBmp FILENAME "..\bitmaps\visual.bmp"
oDlg:bPainted = {| hDC | BmpTiled( hDC, oDlg, oBmp ) }
ACTIVATE DIALOG oDlg CENTERED
oFont:End()
oBold:End()
RETURN NIL
STATIC FUNCTION BmpTiled( hDC, oWnd, oBmp )
LOCAL nWidth := oWnd:nWidth(), nHeight := oWnd:nHeight()
LOCAL nRow := 0, nCol := 0, n
LOCAL nBmpWidth := oBmp:nWidth(), nBmpHeight := oBmp:nHeight()
IF oBmp:hBitmap == 0
RETURN NIL
ENDIF
WHILE nRow < nHeight
nCol = 0
WHILE nCol < nWidth
PalBmpDraw( hDC, nRow, nCol, oBmp:hBitmap )
nCol += nBmpWidth
END
nRow += nBmpHeight
END
RETURN NIL
// FIN / END - kapiabafwh@gmail.com
Regards, saludos.