Dear All ,
Want to use MS Segoe MDL2 icons in the application. Could you please provide help on this. Thanks in advance...!
Thanks
Shridhar
Shridhar
FWH 24.04, BCC 7 32 bit, MariaDB
Dear All ,
Want to use MS Segoe MDL2 icons in the application. Could you please provide help on this. Thanks in advance...!
Thanks
Shridhar
Want to use MS Segoe MDL2 icons in the application.
Could you please provide help on this. Thanks in advance...!
#include "fivewin.ch"
FUNCTION MAIN()
local aData := {}
local oFont, oSymbol
local oDlg, oBrw
local n, oBtn1, oBtn2, oBtn3
FOR n := 0xE100 to 0XE140
AAdd( aData, { n, HB_UTF8CHR( n ) } )
NEXT
DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-20
IF IsWindows10()
DEFINE FONT oSymbol NAME "Segoe MDL2 Assets" SIZE 0,-20
ELSE
DEFINE FONT oSymbol NAME "Segoe UI Symbol" SIZE 0,-20
ENDIF
DEFINE DIALOG oDlg SIZE 350,550 PIXEL TRUEPIXEL FONT oFont
@ 20,20 XBROWSE oBrw SIZE -150, -20 PIXEL OF oDlg DATASOURCE aData ;
AUTOCOLS NOBORDER
// for HARBOUR = HB_NUMTOHEX
oBrw:aCols[ 1 ]:bEditValue := { || NUMTOHEX( oBrw:aRow[ 1 ] ) }
oBrw:aCols[ 2 ]:oDataFont := oSymbol
oBrw:CreateFromCode()
@ 80, 220 BTNBMP oBtn1 PROMPT " Save " RESOURCE 0xE115 TOP 2007 ROUND OF oDlg SIZE 100, 120
//FWH understands that the number 0xE105 should be displayed as a symbol.
// oBtn1:lAdjust := .T.
@ 220, 220 BTNBMP oBtn2 PROMPT " Save " RESOURCE 0xE105 LEFT 2007 ROUND OF oDlg SIZE 120, 100
@ 350, 220 BTNBMP oBtn3 PROMPT " Exit " RESOURCE 0xE10F ACTION oDlg:End() LEFT 2007 OF oDlg SIZE 120, 100
//FWH understands that the number 0xE105 should be displayed as a symbol.
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont, oSymbol
RETURN NILHi Uwe ,
Many Thanks for this code.
Thanks
Shridhar
if lSegoe
nHeight := Int( Min( aRect[ 1 ] - aRect[ 3 ], aRect[ 4 ] - aRect[ 2 ] ) * 0.6 )
cFace := If( lWin10, "Segoe MDL2 Assets", "Segoe UI Symbol" )
DEFINE FONT oFont NAME cFace SIZE 0, -nHeight
if oFont:hFont == 0
lSegoe := .f.
else
cText := HB_UTF8CHR( nChr )
nBkMode := SetBkMode( hDC, TRANSPARENT )
x := Int( 0.2 * ( aRect[ 4 ] - aRect[ 2 ] ) ) //// -> line 785
aRect[ 2 ] += x
aRect[ 4 ] += x
DrawTextEx( hDC, cText, aRect, DT_CENTER + DT_VCENTER + DT_SINGLELINE, oFont:hFont, nClrText )
endif
RELEASE FONT oFont
endif if lSegoe
nHeight := Int( Min( aRect[ 1 ] - aRect[ 3 ], aRect[ 4 ] - aRect[ 2 ] ) * 0.6 )
cFace := If( lWin10, "Segoe MDL2 Assets", "Segoe UI Symbol" )
DEFINE FONT oFont NAME cFace SIZE 0, -nHeight
if oFont:hFont == 0
lSegoe := .f.
else
cText := HB_UTF8CHR( nChr )
nBkMode := SetBkMode( hDC, TRANSPARENT )
///x := Int( 0.2 * ( aRect[ 4 ] - aRect[ 2 ] ) )
/// Change
If lWin10
x := Int( 0.1 * ( aRect[ 4 ] - aRect[ 2 ] ) )
Else
x := Int( 0.14 * ( aRect[ 4 ] - aRect[ 2 ] ) )
EndIf
/// End Change
aRect[ 2 ] += x
aRect[ 4 ] += x
DrawTextEx( hDC, cText, aRect, DT_CENTER + DT_VCENTER + DT_SINGLELINE, oFont:hFont, nClrText )
endif
RELEASE FONT oFont
endifWindows 10 comes with Segoe MDL2 Assets font.
Windows 8 comes with Segoe UI Symbol font.
Windows 7 does not have these fonts.
If you use Segoe MDL2 Assets font in your application, that will not run on clients' Windows 7 computers.
Windows 7 has the "Segoe Ui Symbol" font, but has few symbols.
Giovany Vecchi wrote:Windows 7 has the "Segoe Ui Symbol" font, but has few symbols.
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
AddFontResource("segmdl2_7.ttf")
RETURN NIL cFace := If( lWin10, "Segoe MDL2 Assets", "Segoe MDL2 Assets Seven" )
DEFINE FONT oFont NAME cFace SIZE 0, -nHeight
if oFont:hFont == 0
lSegoe := .f.
else
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
endiffunction Test()
local hBmp, oWnd, cFile
hBmp := FW_TextToBitmap( HB_UTF8CHR( 0xE105 ), { "Segoe MDL2 Assets", -40 } )
FW_SaveImage( hBmp, "SYMBOL.BMP" )
DeleteObject( hBmp )
DEFINE WINDOW oWnd
ACTIVATE WINDOW oWnd CENTERED ;
ON PAINT oWnd:DrawImage( "symbol.bmp" )
return nil If lWin10
x := Int( 0.1 * ( aRect[ 4 ] - aRect[ 2 ] ) )
Else
x := Int( 0.14 * ( aRect[ 4 ] - aRect[ 2 ] ) )
EndIfMr. Rao,
thank You very much
exactly the solution I've been looking for.
What I'm planning to do :
something to do
I think it belongs to this topic
regards
Uwe ![]()
&
Start with \fwh\samples\uisymbol.prg
For Mr. Shridhar, suggest websites you know which provide free icon-sets.
