karinha wrote:Silvio, tell me where I'm going wrong now, please.
Silvio, dime ahora en qué me equivoco, por favor.
- Code: Select all Expand view
// 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 NILSTATIC 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.
1. I wish btnbmp with border noround and the color of border must be RGB( 195, 195, 185 )
2. the color of dialog must be CLR_BLACK, RGB( 245,245,235) no with background image
¿Ves que después de presionar se forma un borde interno negro?Do you see that after pressing, a black internal border forms?
Please see my test sample
- Code: Select all Expand view
#include "fivewin.ch"
Function test()
local oDlg,oFont,oBold
local oCursorBtn :=TCursor():New(,'HAND')
local oBtn:=array(2)
local nWd := GetSysMetrics(0) * .58
local nHt := (GetSysMetrics(1) / 2 ) -20
oFont := TFont():New( "TAHOMA", 0, 14,, )
oBold := TFont():New( "TAHOMA", 0, 14,,.t. )
DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL ;
FONT oFont COLOR CLR_BLACK, RGB( 245,245,235) ;
STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
WS_MINIMIZEBOX)
@ 10, 30 BTNBMP obtn[1] ;
PROMPT "text" LEFT ;
FILENAME "1.bmp" ;
SIZE 45, 13 PIXEL FLAT NOROUND GDIP OF oDlg ;
ACTION NIL
@ 30, 30 BTNBMP obtn[2] ;
PROMPT "text" LEFT ;
FILENAME "2.bmp" ;
SIZE 45, 13 PIXEL FLAT NOROUND GDIP OF oDlg ;
ACTION NIL
For n= 1 to len(oBtn)
obtn[n]:bClrGrad := < |u,oBtn|
local clr := RGB( 245,245,235)
if oBtn:lActive
if oBtn:lMOver
clr := {{ 1, RGB( 250,250,245),RGB( 250,250,245) }}
elseif oBtn:lPressed
clr := RGB( 180,136,85 )
elseif obtn:lProcessing
clr := RGB( 245,245,235)
endif
endif
return clr
>
obtn[n]:nClrBorder := RGB(195,195,185)
obtn[n]:oCursor:= oCursorBtn
next
Activate DIALOG oDlg
RELEASE oFont,oBold
return ni
en mi clase Tbtnclr cuando presiono el botón no se forma ningún borde negro interno
![Image](https://i.postimg.cc/CxbgqynC/hhh.gif)
el procedimiento probablemente sea incorrecto al crear el borde, de lo contrario no se puede explicar
in my Tbtnclr class when I press the button no internal black border is formed
the procedure is probably wrong when creating the border otherwise it can't be explained
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com