function Test()
local oDlg, oFont, aBtn[ 7 ]
local nRow, nCol, n
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 600,200 PIXEL TRUEPIXEL FONT oFont
nRow := 50
nCol := 30
for n := 1 to 7
@ nRow, nCol BTNBMP aBtn[ n ] RESOURCE "c:\fwh\bitmaps\alphabmp\world.bmp" ;
PROMPT LTrim( Str( n ) ) + " " ;
SIZE 64,64 PIXEL OF oDlg FLAT TOP COLOR CLR_WHITE,CLR_GREEN NOBORDER
WITH OBJECT aBtn[ n ]
:Cargo := n
:bAction := { |oBtn| oBtn:Toggle() }
:bPainted := { |hDC| FW_DrawImage( hDC, "c:\fwh\bitmaps\alphabmp\task.bmp", { 2, 30, 34, 62 } ) }
:bClrGrad := { |l,oBtn| If( oBtn:lPressed, CLR_HRED, CLR_GREEN ) }
END
nCol += 80
next n
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
FW_SayText( oWnd, cText, aRect, cAlign, oFont, nClrText, nClrBack, lBorder, nAddStyle ) // oWnd or hDC
? FW_SayText( oWnd, cText, aRect, cAlign, oFont, nClrText, nClrBack, lBorder, nAddStyle ) // oWnd or hDC
? FW_DrawImage( hDC, "c:\fwh\bitmaps\alphabmp\task.bmp", { 2, 30, 34, 62 } ) }
Otto wrote:Dear Mr Rao,
can you please show me on this example how to get this working.
:bPainted := { |hDC| DrawText( hDC, LTrim( Str( n ) ) + " " , { 2, 30, 34, 62 } ) }
In my case it is always 8.
How can I add to more textlines to the button with different fonts.
Thank you in advance
Otto
Otto wrote:Dear Cristobal,
here is the same problem with the values.
We need to use detached locals but I can’t get it working.
It it works for the different fonts I have to check.
Best regards
Otto
:Cargo := LTrim( Str( n ) )
:bPainted := { | hDC, cP, oBtn | DrawText( hDC, oBtn:Cargo + " " , { 2, 30, 34, 62 } ) }
function TestCurrent()
local oDlg, oFont, oBtn, aBtn[ 7 ]
local nRow, nCol, n
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 600,200 PIXEL TRUEPIXEL FONT oFont
nRow := 50
nCol := 30
for n := 1 to 7
@ nRow, nCol BTNBMP aBtn[ n ] RESOURCE "c:\fwh\bitmaps\alphabmp\world.bmp" ;
SIZE 64,64 PIXEL OF oDlg FLAT TOP COLOR CLR_WHITE,CLR_GREEN NOBORDER
WITH OBJECT ( oBtn := aBtn[ n ] )
:Cargo := n
:bAction := { |oBtn| oBtn:Toggle() }
:bClrGrad := { |l,oBtn| If( oBtn:lPressed, CLR_HRED, CLR_GREEN ) }
END
nCol += 80
next n
for each oBtn in aBtn
oBtn:bPainted := { |hDC| FW_DrawImage( hDC, "c:\fwh\bitmaps\alphabmp\task.bmp", { 2, 30, 34, 62 } ), ;
FW_SayText( hDC, oBtn:Cargo, { 40, 2, 63, 25 },,oFont, CLR_HRED, nARGB(255,CLR_YELLOW), .t. ) }
next
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
function TestCurrent()
local oWnd, oBold, oMedium, oSmall, cText
DEFINE FONT oBold NAME "COPPERPLATE GOTHIC BOLD" SIZE 0,-24
DEFINE FONT oMedium NAME "VERDANA" SIZE 0,-16
DEFINE FONT oSmall NAME "TAHOMA" SIZE 0,-11
cText := "This is Bold Font" + CRLF + ;
"Text in Medium Font" + CRLF + ;
"Some more text in small font" + CRLF + ;
"spanning multiple lines."
DEFINE WINDOW oWnd
ACTIVATE WINDOW oWnd CENTERED ;
ON PAINT oWnd:SayText( cText, nil, nil, { oBold, oMedium, oSmall, oSmall } )
RELEASE FONT oBold, oMedium, oSmall
return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 58 guests