Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GuiToolTip.au3>
- #include <WinAPI.au3>
- #include <GUIConstantsEx.au3>
- #include <FontConstants.au3>
- #include <SendMessage.au3>
- #include <WindowsConstants.au3>
- #Region _OneBigToolTip($btt_MSG,$btt_Temp,$btt_Left,$btt_Top,$btt_Size=False)
- #comments-start
- ; #FUNCTION# ====================================================================================================================
- ; Name ..........: _OneBigToolTip()
- ; Description ...: Cria um ToolTip de tamanhos variados
- ; Syntax ........: _OneBigToolTip($btt_MSG, $btt_Temp,$fSize=20,$BigTTFont='Tahoma',$BigTTposX= @DesktopWidth / 2, $BigTTposY= @DesktopHeight / 2,$BigTTiW=1,$BigTTTransf=0)
- ; Parameters ....: $btt_MSG mensagem a ser exibida
- ;~ $btt_Temp tempo da mensagem(False: exibirá a mensagem no tempo minimo de 100ms)
- ;~ $fSize tamanho da fonte(False: exibirá a fonte com tamanho minimo de 10pt)
- ;~ $BigTTFont fonte a ser usada, Courier, Courier New,Arial,Comic Sans MS, Verdana, Times New Roman mais em(https://www.autoitscript.com/autoit3/docs/appendix/fonts.htm)
- ;~ $BigTTposX= posição horizontal(False: exibirá a partir do centro da tela na horizontal)
- ;~ $BigTTposY= posição vertical(False: exibirá a partir do centro da tela na vertical)
- ;~ $BigTTiW força do riscado da fonte(numeros não válidos não mostrarão efeitos), 0=normal 1=fino 2=negrito
- ;~ $BigTTTransf: Transformação da fonte 0= itálico 1= Subilinhado 2=Riscado 3=Itálico+Subilinhado, 4=Itálico+Riscado,5=Subilinhado+Riscado,6=Itálico+Riscado+Subilinhado
- ; Return values .: Sucesso - mensagem sendo exibida
- ; Author ........: BrewManNH,marsfann,blisszero (visite Forum AutoIT Brasil - http://forum.autoitbrasil.com/), https://www.autoitscript.com/forum/topic/179865-how-to-change-tooitip-font-size/
- ; Example .......: _OneBigToolTip('Mostrando um tooltip grande',2500,50,'Comic Sans MS')
- ; Remarks .......: ainda não é funcinal em scripts com algumas guis
- #comments-end
- Func _OneBigToolTip($btt_MSG, $btt_Temp=100,$fSize=20,$BigTTFont='Tahoma',$BigTTposX= @DesktopWidth / 2, $BigTTposY= @DesktopHeight / 2,$BigTTiW=1,$BigTTTransf=0,$BigTTBallon=0)
- If $BigTTposX= False Then $BigTTposX= @DesktopWidth / 2
- If $BigTTposY= False Then $BigTTposY= @DesktopHeight / 2
- If $btt_Temp < 100 Then $btt_Temp = 100
- If $fSize < 10 Then $fSize = 10
- If $BigTTTransf > 6 Then
- $BigTTTransf = 0
- ElseIf $BigTTTransf < 0 Then
- $BigTTTransf = 0
- EndIf
- ;~ determina que tipo de tooltip será exibido
- Switch $BigTTBallon
- Case 0
- $BigTTBallon = '0x01' ;sempre acima das janelas padrão
- Case 1
- $BigTTBallon = '0x40' ;Balão
- Case 2
- $BigTTBallon = '0x80' ;'X' para fechar
- EndSwitch
- ;~ cria o tooltip
- Local $hToolTip = _GUIToolTip_Create(0,$TTS_CLOSE), $hDC = _WinAPI_GetDC(0)
- _GUIToolTip_SetMaxTipWidth($hToolTip, @DesktopWidth - $BigTTposX)
- WinSetOnTop ($hToolTip, "", $WINDOWS_ONTOP)
- ;~ cria a fonte a ser executada no tolltip
- Switch $BigTTiW
- Case 2
- $BigTTiWeight = 800
- Case 1
- $BigTTiWeight = 100
- Case Else
- $BigTTiWeight = 500
- EndSwitch
- Switch $BigTTTransf
- Case 0
- Local $hTransf_i = True, $hTransf_u = False, $hTransf_s = False
- Case 1
- Local $hTransf_i = False, $hTransf_u = True, $hTransf_s = False
- Case 2
- Local $hTransf_i = False, $hTransf_u = True, $hTransf_s = False
- Case 3
- Local $hTransf_i = True, $hTransf_u = True, $hTransf_s = False
- Case 4
- Local $hTransf_i = True, $hTransf_u = False, $hTransf_s = True
- Case 5
- Local $hTransf_i = False, $hTransf_u = True, $hTransf_s = True
- Case 6
- Local $hTransf_i = True, $hTransf_u = True, $hTransf_s = True
- Case Else
- Local $hTransf_i = False, $hTransf_u = False, $hTransf_s = False
- EndSwitch
- Local $hFont = _WinAPI_CreateFont($fSize, 0, 0, 0, $BigTTiWeight, $hTransf_i, $hTransf_u, $hTransf_s, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, $BigTTFont)
- Local $hOldFont = _WinAPI_SelectObject($hDC, $hFont)
- _SendMessage($hToolTip, $WM_SETFONT, $hFont, True)
- ;~ prioriza a exibição da fonte
- _GUIToolTip_AddTool($hToolTip, 0, $btt_MSG, 0, 0, 0, 0, 0, BitOR($TTF_TRACK, $TTF_ABSOLUTE))
- ;~ posição do tooltip
- _GUIToolTip_TrackPosition($hToolTip, $BigTTposX, $BigTTposY)
- ;~ verifica atividade
- _GUIToolTip_TrackActivate($hToolTip, True, 0, 0)
- ;~ tempo de exibição
- Sleep($btt_Temp)
- ;~ apaga o ToolTip
- _GUIToolTip_Destroy($hToolTip)
- EndFunc
- #EndRegion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement