Skysnake Posted March 14, 2023 Share Posted March 14, 2023 (edited) expandcollapse popup; #include <FontConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Local $hGUI = GUICreate("Example", 200, 200) ; 2023.03.12 FontIcon! Local $sFont, $s ; define reusable vars $sFont = "Segoe UI Symbol" ; <-- a default Windows font GUISetFont(24, $FW_NORMAL, $GUI_FONTNORMAL, $sFont) ; <-- set font, Font Size does not affect Menus $s = ChrW(0xE160) ; hand $idFilemenu = GUICtrlCreateMenu($s & " &File Index ") $sFont = "Segoe UI Symbol" ; <-- a default Windows font GUISetFont(24, $FW_NORMAL, $GUI_FONTNORMAL, $sFont) ; <-- set font, Font Size does not affect Menus $s = ChrW(0xE203) ; OK Local $idFileItem = GUICtrlCreateMenuItem($s & " File Option", $idFilemenu) GUICtrlCreateMenuItem("", $idFilemenu) ; create a separator line $sFont = "Segoe UI Symbol" ; <-- a default Windows font GUISetFont(24, $FW_NORMAL, $GUI_FONTNORMAL, $sFont) ; <-- set font, Font Size does not affect Menus $s = ChrW(0x26DD) ; box with cross Local $idExit = GUICtrlCreateMenuItem($s & " Exit ", $idFilemenu) $sFont = "Segoe MDL2 Assets" ; <-- a default Windows font GUISetFont(24, $FW_NORMAL, $GUI_FONTNORMAL, $sFont) ; <-- make font size half of button dimensions $s = ChrW(0xE2F6) Local $iconPrint = GUICtrlCreateButton($s, 8, 28, 48, 48) ; <-- button containing fonticon $sFont = "Segoe UI Emoji" ; <-- a default Windows font GUISetFont(24, $FW_NORMAL, $GUI_FONTNORMAL, $sFont) ; <-- make font size half of button dimensions $s = ChrW(0x2668) Local $iconMedal = GUICtrlCreateButton($s, 60, 28, 48, 48) ; <-- button containing fonticon $sFont = "Segoe UI Symbol" ; <-- a default Windows font GUISetFont(24, $FW_NORMAL, $GUI_FONTNORMAL, $sFont) ; <-- make font size half of button dimensions $s = ChrW(0xE129) Local $iconPennon = GUICtrlCreateButton($s, 112, 28, 48, 48) ; <-- button containing fonticon ; take care to reset to an easy read font $sFont = "Segoe" GUISetFont(12, 400, 0, $sFont) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idExit ExitLoop Case $iconPrint MsgBox(0, "FontIcon", "You have clicked a FontIcon!") Case $iconMedal MsgBox(0, "FontIcon Emoji", "Hotstuff!") Case $iconPennon MsgBox(0, "FontIcon Symbol", "Keep the Flag flying") Case $idFileItem MsgBox(0, "Menu Item!", "Do Something!") EndSwitch WEnd GUIDelete($hGUI) A picture paints a thousand words, and having access to icons often contributes to the aesthetics of a GUI. It's not always easy or convenient to make icon files, or compile these into a DLL for later use. Fortunately the onboard Windows Segoe font family provides access to a whole set of font icons. A font icon is a font character that does not paint a letter, but a picture, like an emoji. Using a FontIcon also allows placing images directly into menu items, which would otherwise require a lot of work Edited March 20, 2023 by Skysnake Fixed spelling argumentum 1 Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
Zedna Posted March 26, 2023 Share Posted March 26, 2023 (edited) On the first look it seems to be good idea but it has one BIG disadvantage: On every diferent Windows version fonts (generaly) are not the same/compatible, so finally your application can look very badly on other computers ... Because of that I don't recommend this approach. Sorry for bad news ... Edited March 26, 2023 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now