How to use Segoe MDL2 icons on Win 7 ?

User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: How to use Segoe MDL2 icons on Win 7 ?

Post by nageswaragunupudi »

What characters did you use for Add / Modify ?
Regards

G. N. Rao.
Hyderabad, India
User avatar
Giovany Vecchi
Posts: 129
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: How to use Segoe MDL2 icons on Win 7 ?

Post by Giovany Vecchi »

I changed the Buttonb.prg class and not to change the bitmaps everywhere I did a translation of "bitmap name for symbol code"

Install the UI-Character to see the font symbols. Works only on windows 10

https://www.microsoft.com/en-us/p/ui-ch ... blggh5kll7

Code: Select all

Method BmpToSymbol(f_cBitMap) Class TButtonBmp
  Local uCodeOrBmp := Nil
  
  If Empty(f_cBitMap) 
    Return nil
  EndIf

  If ValType(f_cBitMap) == "N"
    ::lBmpCodeFnt := .T.
    Return f_cBitMap
  EndIf

  f_cBitmap := Upper(f_cBitMap)
  
  If Hb_At("CANCE",f_cBitMap) > 0
    uCodeOrBmp := 59961 //X-roundNegativo=60304 //X=59719
  ElseIf Hb_At("ALTERA",f_cBitMap) > 0 
    uCodeOrBmp := 61014
  ElseIf Hb_At("BORRACHA",f_cBitMap) > 0 .OR. ;
         Hb_At("APAGA",f_cBitMap) > 0 
    uCodeOrBmp := 59228
  ElseIf Hb_At("CALENDARIO",f_cBitMap) > 0 
    uCodeOrBmp := 59637
  ElseIf Hb_At("CALCULADORA",f_cBitMap) > 0 
    uCodeOrBmp := 59631
  ElseIf Hb_At("CONFIRMA",f_cBitMap) > 0 
    uCodeOrBmp := 59696 //mao=57759
  ElseIf Hb_At("DATAEXTRACT",f_cBitMap) > 0 
    uCodeOrBmp := 58036
  ElseIf Hb_At("DATAINSERT",f_cBitMap) > 0 
    uCodeOrBmp := 58035
  ElseIf Hb_At("DETALHE",f_cBitMap) > 0 
    uCodeOrBmp := 57692
  ElseIf Hb_At("EMAIL",f_cBitMap) > 0 
    uCodeOrBmp := 59992 //57632
  ElseIf Hb_At("ENGRENAGEM",f_cBitMap) > 0 
    uCodeOrBmp := 57621
  ElseIf Hb_At("LIXO",f_cBitMap) > 0 
    uCodeOrBmp := 57607 // 59213
  ElseIf Hb_At("EXCLUI",f_cBitMap) > 0 .OR. ;
         Hb_At("DELET",f_cBitMap) > 0 
    uCodeOrBmp := 59228
  ElseIf Hb_At("FILT",f_cBitMap) > 0 
    uCodeOrBmp := 57710
  ElseIf Hb_At("GRAVA",f_cBitMap) > 0 .OR. ;
         Hb_At("SALVA",f_cBitMap) > 0
    uCodeOrBmp := 59214
  ElseIf Hb_At("IMPORT",f_cBitMap) > 0 
    uCodeOrBmp := 57624
  ElseIf Hb_At("INCLUI",f_cBitMap) > 0 .OR. ;
         Hb_At("NOVO",f_cBitMap) > 0
    uCodeOrBmp := 60616
  ElseIf Hb_At("INTERROGACAO",f_cBitMap) > 0 
    uCodeOrBmp := 59543 //61762
  ElseIf Hb_At("_OK",f_cBitMap) > 0 
    uCodeOrBmp := 59696 //V-roundNegativo=60513 //V=59643 
  ElseIf Hb_At("SCAN",f_cBitMap) > 0 
    uCodeOrBmp := 59646
  ElseIf Hb_At("EXIT",f_cBitMap) > 0 
    uCodeOrBmp := 59368 //59718
  ElseIf Hb_At("REVERTCLOCK",f_cBitMap) > 0 
    uCodeOrBmp := 59420
  ElseIf Hb_At("SELECIONA",f_cBitMap) > 0 
    uCodeOrBmp := 57506
  ElseIf Hb_At("CARIMBO",f_cBitMap) > 0 
    uCodeOrBmp := 57796
  ElseIf Hb_At("LUPA",f_cBitMap) > 0 
    uCodeOrBmp := 57626
  ElseIf Hb_At("PRINTERECF",f_cBitMap) > 0 
    uCodeOrBmp := 60507
  ElseIf Hb_At("PRINTER",f_cBitMap) > 0 
    uCodeOrBmp := 59209
  ElseIf Hb_At("_RUN",f_cBitMap) > 0 
    uCodeOrBmp := 59717
  ElseIf Hb_At("SETA_CICLO",f_cBitMap) > 0 
    uCodeOrBmp := 57623
  ElseIf Hb_At("VISUALIZA",f_cBitMap) > 0 
    uCodeOrBmp := 61853
  
  Else
    uCodeOrBmp := f_cBitMap  
  EndIf

  If ValType(uCodeOrBmp) == "N"
    ::lBmpCodeFnt := .T.
  EndIf
  

Return uCodeOrBmp
 
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: How to use Segoe MDL2 icons on Win 7 ?

Post by ukoenig »

Is it possible to display a selected symbol with a different color
instead of black inside a button and saving it colored ?
Mr. Rao's solution works fine but the symbols are saved only in black

regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: How to use Segoe MDL2 icons on Win 7 ?

Post by nageswaragunupudi »

You can specify the colors.
See the full syntax of the functions.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Giovany Vecchi
Posts: 129
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: How to use Segoe MDL2 icons on Win 7 ?

Post by Giovany Vecchi »

Assign the Button object to "bColorMap"
Example
     :: bColorMap: = {|| {CLR_WHITE, CLR_HRED}}

Image
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: How to use Segoe MDL2 icons on Win 7 ?

Post by ukoenig »

Thank You very much
tested and works

for saving symbols colored I added :

hBmp := FW_TextToBitmap( HB_UTF8CHR( 0xE105 ), { "Segoe MDL2 Assets", -40 }, 255,,,.T. ) // = red
FW_SaveImage( hBmp, "SYMBOL.BMP" )
DeleteObject( hBmp )

all infos I need are complete

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: How to use Segoe MDL2 icons on Win 7 ?

Post by ukoenig »

starting with the tool I noticed another painting problem
Next I would like to load a font from file NOT system-installed
to rip and save any useful symbols
There will be a color-section to optimize and arange the different colors.

Image

The three painted buttons

Code: Select all

// rip icon from external file
@ 50, 500 BTNBMP oBtn3 PROMPT " Rip " RESOURCE 0xE115 FONT oSegoe ;
ACTION SETIMAGE( oImage ) ;
ROUND BORDER TOP OF oFld:aDialogs[ 1 ] SIZE 100, 100 ;
COLOR nBTColor, nBColor
oBtn3:bColorMap := {|| { , nSColor } }

@ 50,620 XIMAGE oImage SIZE 100,100 OF oFld:aDialogs[ 1 ] PIXEL

@ 360, 500 BTNBMP oBtn1 PROMPT " Save " RESOURCE 0xE105 FONT oSegoe ;
ACTION MAKE_IMG(aData) ;
ROUND BORDER TOP OF oFld:aDialogs[ 1 ] SIZE 100, 100 ;
COLOR nBTColor, nBColor
oBtn1:bColorMap := {|| { , nSColor } }

@ 360, 630 BTNBMP oBtn2 PROMPT " Save " RESOURCE 0xE105 FONT oAsset ;
ACTION F_BACKGRD( oFld, CLR_GREEN ) ;
ROUND BORDER TOP  OF oFld:aDialogs[ 1 ] SIZE 100, 100 ;
COLOR nBTColor, nBColor
oBtn2:bColorMap := {|| { , nSColor } }
 
using a font from file I tested this solution but doesn't work good

Code: Select all

FUNC GetNewFont(cFont, nSize) //Resource Matrix Font
LOCAL hRes  := FindResource( GetResources(), cFont, 10) //RT_RCDATA )
LOCAL hFont := LoadResource( GetResources(), hRes )
LOCAL cResFont := cResToStr(cFont,10)
LOCAL nFonts   := 0 
LOCAL nHandle  := AddFontMemResourceEx( hFont, Len(cResFont), 0, @nFonts)
LOCAL oFont := TFont():New("ScreenMatrix",0,-nSize)

oFont:hFont = CreateFont( { -nSize, 0, 0,;
        0,, .f.,;
        .f., .f., 1,;
        0, 0,;
        0, 0, "ScreenMatrix" } )

RETURN oFont

//-------------------------

DLL32 FUNCTION AddFontMemResourceEx(nAddr AS PTR, nLen AS DWORD, nPdv AS LONG, @nCnt AS DWORD) ;
      AS LONG PASCAL FROM "AddFontMemResourceEx" LIB "gdi32.dll"
DLL32 FUNCTION RemoveFontMemResourceEx( nHnd AS LONG) AS BOOL;
              PASCAL FROM "RemoveFontMemResourceEx" LIB "gdi32.dll"
 
regards
Uwe :(
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: How to use Segoe MDL2 icons on Win 7 ?

Post by ukoenig »

A question and a preview ( logic ) of the new tool I'm working on.
I think with this solution there is no need to look for any icon-collections
because we can rip any needed symbol from the different fonts.
The symbol can be saved as bmp,png,jpg,gif,ico,cur,tif,emf or wmf
and in sizes 16x16, 24x24, 32x32, 48x48 and 64x64
As well we can define a colorset of dialog-background, buttoncolors, symbols and textcolor.
All this can be saved to a defined project

I noticed a problem to show different symbols using Btnbmp with "Segoe UI Symbol"
I'm using 2 browser to select from different fonts

DEFINE FONT oFont1 NAME "Segoe UI Symbol" SIZE 0,-25
DEFINE FONT oFont2 NAME "Segoe MDL2 Assets" SIZE 0, -25


because of the same HEX, Btnbmp selects symbols from "Segoe MDL2 Assets"
AAdd( aData1, { n, NUMTOHEX( n ), HB_UTF8CHR( n ) } )
AAdd( aData2, { n, NUMTOHEX( n ), HB_UTF8CHR( n ) } )

xBrowse knows the font to be used :aCols[ 3 ]:oDataFont := oFont1 :!:

How to define that BTNBMP must use "Segoe UI Symbol" with the same HEX like "Segoe MDL2 Assets"

---------

@ 360, 650 BTNBMP oBtn2 PROMPT " Save " ;
RESOURCE aData1[nResource][1] FONT oFont1 ; // hex-value from "Segoe UI Symbol" :roll:
ACTION MAKE_IMG( aData1[nResource][1], oFont, oFont1 ) ; //create the image
ROUND NOBORDER LEFT OF oFld:aDialogs[ 1 ] SIZE 140, 80 ;
COLOR nBTColor, nBColor UPDATE
oBtn2:bColorMap := {|| { , nSColor } }
oBtn2:bClrGrad := { |lMouseOver, oBtn| If( lMouseOver, 255, 3067734 ) }
oBtn2:nClrText := { |lMouseOver,oBtn| If( lMouseOver, 16777215, 0 ) }

--------

I can create and save images ( png or bmp ) with a defined size and color because there is the font defined
hBmp := FW_TextToBitmap( HB_UTF8CHR( aData ), { cFontname, -80 }, 255,,,.T. )
The image is the same like shown in xbrowse

The screenshot shows button 1 and 2 are using symbols from "Segoe MDL2 Assets"

Image

No problem with "WingDings" because HEX are different

DEFINE FONT oFont3 NAME "WingDings" SIZE 0,-25 CHARSET 2
DEFINE FONT oFont4 NAME "WingDings 2" SIZE 0,-25 CHARSET 2
DEFINE FONT oFont5 NAME "WingDings 3" SIZE 0,-25 CHARSET 2

Image

how to force BtnBmp to use "Segoe UI Symbol" - symbols ?
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Marcelo Roggeri
Posts: 275
Joined: Sat Jul 22, 2006 9:04 pm
Location: Venado Tuerto - Santa Fe -Argentina
Contact:

Re: How to use Segoe MDL2 icons on Win 7 ?

Post by Marcelo Roggeri »

Hola buenos días, necesito ver todas las fuentes Segoe MDL2 y hacer un browse con el codigo de font y su icono,
encontré esto pero solo me muestra un limite de iconos

FOR n := 0xE100 to 0XE140
AAdd( aData, { n, HB_UTF8CHR( n ) } )
NEXT

Gracias de antemano
Saludos
FWH - Harbour - BCC7 - PellesC - FivEdit (Cristobal Navarro)
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: How to use Segoe MDL2 icons on Win 7 ?

Post by nageswaragunupudi »

Marcelo Roggeri wrote:Hola buenos días, necesito ver todas las fuentes Segoe MDL2 y hacer un browse con el codigo de font y su icono,
encontré esto pero solo me muestra un limite de iconos

FOR n := 0xE100 to 0XE140
AAdd( aData, { n, HB_UTF8CHR( n ) } )
NEXT

Gracias de antemano
Saludos
fwh\samples\uisymbol.prg

Also see
https://docs.microsoft.com/en-us/window ... ymbol-font
Regards

G. N. Rao.
Hyderabad, India
User avatar
Marcelo Roggeri
Posts: 275
Joined: Sat Jul 22, 2006 9:04 pm
Location: Venado Tuerto - Santa Fe -Argentina
Contact:

Re: How to use Segoe MDL2 icons on Win 7 ?

Post by Marcelo Roggeri »

Gracias Mr. Rao tan cerca lo tenia. Jaaaa.
Saludos
Marcelo
FWH - Harbour - BCC7 - PellesC - FivEdit (Cristobal Navarro)
jpcavagnaro
Posts: 35
Joined: Tue Oct 11, 2016 1:02 pm

Re: How to use Segoe MDL2 icons on Win 7 ?

Post by jpcavagnaro »

Hola Giovanni, buenas tardes, perdón la molestia.

Estoy tratando de modificar la imagen de mis programas y no logro que me funcione segoe symbol

Me podrías pasar un ejemplo, me gusto mucho el diseño a pesar que no se ve toda la pantalla.


Saludos.-

Jorge Cavagnaro
jpcavagnaro@yahoo.com.ar
User avatar
Giovany Vecchi
Posts: 129
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: How to use Segoe MDL2 icons on Win 7 ?

Post by Giovany Vecchi »

jpcavagnaro wrote:Hola Giovanni, buenas tardes, perdón la molestia.

Estoy tratando de modificar la imagen de mis programas y no logro que me funcione segoe symbol

Me podrías pasar un ejemplo, me gusto mucho el diseño a pesar que no se ve toda la pantalla.


Saludos.-

Jorge Cavagnaro
jpcavagnaro@yahoo.com.ar
Para obtener el resultado que quiero. Tuve que hacer _ en las clases ButtonBmp y cambiar algunas funciones.

Agregue mi skype que luego elimino los procedimientos.

Skype: giovany.vecchi
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: How to use Segoe MDL2 icons on Win 7 ?

Post by nageswaragunupudi »

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

#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
 
Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
Marcelo Roggeri
Posts: 275
Joined: Sat Jul 22, 2006 9:04 pm
Location: Venado Tuerto - Santa Fe -Argentina
Contact:

Re: How to use Segoe MDL2 icons on Win 7 ?

Post by Marcelo Roggeri »

Mr. Rao
Se puede dar color al prompt y otro color al resource ?
Saludos
FWH - Harbour - BCC7 - PellesC - FivEdit (Cristobal Navarro)
Post Reply