Jump to content

How to change tooitip font size?


 Share

Recommended Posts

It seems to work with _WinAPI_CreateFont and _SendMessage :

 

#include <GUIConstantsEx.au3>
#include <GUIToolTip.au3>
#include <FontConstants.au3>
#include <SendMessage.au3>
#include <WindowsConstants.au3>

Local $hGUI = GUICreate("GUI", 300, 200)
Local $IDButton = GUICtrlCreateButton("Button", 10, 10, 200, 30)
Local $hToolTip = _GUIToolTip_Create(0, $TTS_BALLOON)

_GUIToolTip_AddTool($hToolTip, 0, "Tooltip with the specified font", GUICtrlGetHandle($IDButton) )

GUISetState(@SW_SHOW)

Local $hDC = _WinAPI_GetDC(0)
Local $hFont = _WinAPI_CreateFont(50, 0, 0, 0, 800, False, False, False, $DEFAULT_CHARSET, _
        $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Verdana')
$hOldFont = _WinAPI_SelectObject($hDC, $hFont)
_SendMessage ($hToolTip, $WM_SETFONT, $hFont, TRUE)

Do 
Until GUIGetMsg() = $GUI_EVENT_CLOSE

_WinAPI_SelectObject($hDC, $hOldFont)
_GUIToolTip_Destroy($hToolTip)
_WinAPI_DeleteObject($hFont)
_WinAPI_ReleaseDC(0, $hDC)
_WinAPI_InvalidateRect(0, 0)

 

Link to comment
Share on other sites

The tooltip font size is system dependent. You'd have to change it through the desktop properties.

You could try creating your own tooltip with adjustable font properties or perhaps a TrayTip?

if i use "GUICreate" ,when i play the game that is fullscreen

gmae will be minimize or crash

so, I have to use tooltip

Link to comment
Share on other sites

Look at the GUIToolTip_TrackPosition example script, you don't even need the GUI in that one. Combine the correct tracking functions for the tooltip with jguinch's code to get what you're looking for.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Help file

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Look at the GUIToolTip_TrackPosition example script, you don't even need the GUI in that one. Combine the correct tracking functions for the tooltip with jguinch's code to get what you're looking for.

Use "GUIToolTip_TrackPosition",tooltip will trace my mouse

 

 

#include <GuiToolTip.au3>
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <FontConstants.au3>
#include <SendMessage.au3>
#include <WindowsConstants.au3>

Local $hToolTip = _GUIToolTip_Create(0), $hDC = _WinAPI_GetDC(0)
Local $hFont = _WinAPI_CreateFont(32, 0, 0, 0, 800, False, False, False, $DEFAULT_CHARSET,$OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Tahoma')
Local $hOldFont = _WinAPI_SelectObject($hDC, $hFont)
_SendMessage ($hToolTip, $WM_SETFONT, $hFont, TRUE)
_GUIToolTip_AddTool($hToolTip, 0, "55555555555555555")
_GUIToolTip_TrackPosition($hToolTip,0 ,0)
_GUIToolTip_TrackActivate($hToolTip, True, 0, 0)
Sleep(1500)
_GUIToolTip_UpdateTipText($hToolTip, 0, 0, "999999999999")
Sleep(3000)
_GUIToolTip_Destroy($hToolTip)

Link to comment
Share on other sites

Use "GUIToolTip_TrackPosition",tooltip will trace my mouse

It only follows your mouse because the flags for the AddTool function weren't set.

Try this script out and you'll see it won't follow your mouse.

#include <GuiToolTip.au3>
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <FontConstants.au3>
#include <SendMessage.au3>
#include <WindowsConstants.au3>

Local $hToolTip = _GUIToolTip_Create(0), $hDC = _WinAPI_GetDC(0)
Local $hFont = _WinAPI_CreateFont(32, 0, 0, 0, 800, False, False, False, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Tahoma')
Local $hOldFont = _WinAPI_SelectObject($hDC, $hFont)
_SendMessage($hToolTip, $WM_SETFONT, $hFont, True)
_GUIToolTip_AddTool($hToolTip, 0, "55555555555555555", 0, 0, 0, 0, 0, BitOR($TTF_TRACK, $TTF_ABSOLUTE)) ; <<<<<<<<<<<<<<<
_GUIToolTip_TrackPosition($hToolTip, 0, 0)
_GUIToolTip_TrackActivate($hToolTip, True, 0, 0)
Sleep(1500)
_GUIToolTip_UpdateTipText($hToolTip, 0, 0, "999999999999")
_GUIToolTip_TrackPosition($hToolTip, 100, 100)
Sleep(3000)
_GUIToolTip_Destroy($hToolTip)

 

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

It only follows your mouse because the flags for the AddTool function weren't set.

Try this script out and you'll see it won't follow your mouse.

#include <GuiToolTip.au3>
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <FontConstants.au3>
#include <SendMessage.au3>
#include <WindowsConstants.au3>

Local $hToolTip = _GUIToolTip_Create(0), $hDC = _WinAPI_GetDC(0)
Local $hFont = _WinAPI_CreateFont(32, 0, 0, 0, 800, False, False, False, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Tahoma')
Local $hOldFont = _WinAPI_SelectObject($hDC, $hFont)
_SendMessage($hToolTip, $WM_SETFONT, $hFont, True)
_GUIToolTip_AddTool($hToolTip, 0, "55555555555555555", 0, 0, 0, 0, 0, BitOR($TTF_TRACK, $TTF_ABSOLUTE)) ; <<<<<<<<<<<<<<<
_GUIToolTip_TrackPosition($hToolTip, 0, 0)
_GUIToolTip_TrackActivate($hToolTip, True, 0, 0)
Sleep(1500)
_GUIToolTip_UpdateTipText($hToolTip, 0, 0, "999999999999")
_GUIToolTip_TrackPosition($hToolTip, 100, 100)
Sleep(3000)
_GUIToolTip_Destroy($hToolTip)

 

BrewManNH!!!!

thank you so much

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...