nageswaragunupudi wrote:Why do you have to make any changes to buttonbmp class and change many functions?
If your FWH version is not very old, it is very easy to use Segoe MDL2 Assets (if installed) in the place of bitmaps on BTNBMP and also BUTTONBMP, without any changes in the FWH library.
Please try this small test program
- Code: Select all Expand view RUN
#include "fivewin.ch"
function Main()
local oDlg, oFont
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 270,280 PIXEL TRUEPIXEL FONT oFont ;
TITLE "Segoe MDL2 Assets on Buttons"
@ 40, 40 BTNBMP PROMPT "First" RESOURCE 0xE100 SIZE 80,80 PIXEL OF oDlg FLAT
@ 40,150 BTNBMP PROMPT "Last" RESOURCE 0xE101 SIZE 80,80 PIXEL OF oDlg FLAT
@ 160, 40 BUTTONBMP PROMPT "Edit" RESOURCE 0xE104 SIZE 80,80 PIXEL OF oDlg TEXTBOTTOM
@ 160,150 BUTTONBMP PROMPT "Save" RESOURCE 0xE105 SIZE 80,80 PIXEL OF oDlg TEXTBOTTOM
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
Hi Mr Rao. I changed the tButtomBmp class to make the buttons static, so I edit every state transformation at runtime.
To work on Windows Seven, I renamed the font Segoe MDL2 Assets to Segoe MDL2 Assets Seven and at the beginning of the program I execute:
- Code: Select all Expand view RUN
- FUNCTION G_SYMBOL_INSTALL()
Local hDc, aFonts
Local lc_oDb_FrFix
If IsWindows10()
Return nil
EndIf
hDC := GetDC( WndMain():hWnd )
aFonts := ASort( GetFontNames( hDC ) )
ReleaseDC( WndMain():hWnd, hDC )
if AScan( aFonts, "Segoe MDL2 Assets Seven" ) > 0
Return Nil
endif
lmkdir(DIR_TEMP()+"Fonts")
lc_oDb_FrFix := DB_FR_FIX():OpenRdd()
lc_oDb_FrFix:DB_FR_FIX_GetCompress(16,DIR_TEMP(),DIR_TEMP()+"Fonts")
lc_oDb_FrFix:End()
AddFontResource(DIR_TEMP()+"Fonts\segmdl2_7.ttf")
AddFontResource(DIR_TEMP()+"Fonts\segoeuil_7.ttf")
AddFontResource(DIR_TEMP()+"Fonts\seguisym_7.ttf")
RETURN NIL
In the ShowSymbol function in ImgTxtio.prg has these changes.
- Code: Select all Expand view RUN
- if nChr > 8000 //nAnd( nChr, 0xF000 ) == 0xE000
if lSegoe
nHeight := Int( Min( aRect[ 1 ] - aRect[ 3 ], aRect[ 4 ] - aRect[ 2 ] ) * 0.6 )//0.48 ) ///0.6 )
/// Giovany
cFace := If( lWin10, "Segoe MDL2 Assets", "Segoe MDL2 Assets Seven" ) // Change as Windows
DEFINE FONT oFont NAME cFace SIZE 0, -nHeight
if oFont:hFont == 0
lSegoe := .f.
else
//? "ccc"
cText := HB_UTF8CHR( nChr )
SetBkMode( hDC, 1 )
If lWin10
x := Int( 0.1 * ( aRect[ 4 ] - aRect[ 2 ] ) )
Else
x := Int( 0.14 * ( aRect[ 4 ] - aRect[ 2 ] ) )
EndIf
aRect[ 2 ] += x
aRect[ 4 ] += x
DrawTextEx( hDC, cText, aRect, DT_CENTER + DT_VCENTER + DT_SINGLELINE, oFont:hFont, nClrText )
endif
RELEASE FONT oFont
endif
elseif 1==4 //( nFont := nAnd( nChr, 0xFF0000 ) ) <= 0x30000
nHeight := Int( Min( aRect[ 1 ] - aRect[ 3 ], aRect[ 4 ] - aRect[ 2 ] ) * 1.0 )
nChr := nAnd( nChr, 0xFFFF )
nFont /= 0x10000
cFace := "Wingdings" + Str( nFont, 2 )
DEFINE FONT oFont NAME cFace SIZE 0, -nHeight CHARSET 2
cText := Chr( nChr )
SetBkMode( hDC, 1 )
DrawTextEx( hDC, cText, aRect, DT_CENTER + DT_VCENTER + DT_SINGLELINE, oFont:hFont, nClrText )
RELEASE FONT oFont
endif
Now the tButtonBmp class changed
ftp://Contrib:123@giovanyvecchi.no-ip.info:97/buttonb_2018_02.prg