Link to home
Start Free TrialLog in
Avatar of bhatul
bhatul

asked on

How to change font of ToolTip

Dear Friends,
   I am developing a software with regional lnaguage support. When that software is run I want to display the tooltips in language related with that software in the local language. Wsing win API's is the solution. I am looking in that way. Please let me know your views abt it.
Thank you,
Regards,
       bhatul
ASKER CERTIFIED SOLUTION
Avatar of hongjun
hongjun
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Éric Moreau
You need to know local language configuration and load tooltip strings according it.
To know which language is:
(this is a general use to get all values from locale config, modify as you wish)

Option Explicit
'These declarations are designed
'for use in a .bas module
'since the constants are public


Declare Function GetLocaleInfo Lib "kernel32" Alias _
"GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, _
ByVal lpLCData As String, ByVal cchData As Long) As Long

Declare Function SetLocaleInfo Lib "kernel32" Alias _
"SetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, _
ByVal lpLCData As String) As Boolean

Declare Function GetUserDefaultLCID% Lib "kernel32" ()
Public Enum LOCAL_INFO
 LOCALE_ICENTURY = &H24
 LOCALE_ICOUNTRY = &H5
 LOCALE_ICURRDIGITS = &H19
 LOCALE_ICURRENCY = &H1B
 LOCALE_IDATE = &H21
 LOCALE_IDAYLZERO = &H26
 LOCALE_IDEFAULTCODEPAGE = &HB
 LOCALE_IDEFAULTCOUNTRY = &HA
 LOCALE_IDEFAULTLANGUAGE = &H9
 LOCALE_IDIGITS = &H11
 LOCALE_IINTLCURRDIGITS = &H1A
 LOCALE_ILANGUAGE = &H1
 LOCALE_ILDATE = &H22
 LOCALE_ILZERO = &H12
 LOCALE_IMEASURE = &HD
 LOCALE_IMONLZERO = &H27
 LOCALE_INEGCURR = &H1C
 LOCALE_INEGSEPBYSPACE = &H57
 LOCALE_INEGSIGNPOSN = &H53
 LOCALE_INEGSYMPRECEDES = &H56
 LOCALE_IPOSSEPBYSPACE = &H55
 LOCALE_IPOSSIGNPOSN = &H52
 LOCALE_IPOSSYMPRECEDES = &H54
 LOCALE_ITIME = &H23
 LOCALE_ITLZERO = &H25
 LOCALE_NOUSEROVERRIDE = &H80000000
 SymbolAM = &H28
 SymbolPM = &H29
 LOCALE_SABBREVCTRYNAME = &H7
 LOCALE_SABBREVDAYNAME1 = &H31
 LOCALE_SABBREVDAYNAME2 = &H32
 LOCALE_SABBREVDAYNAME3 = &H33
 LOCALE_SABBREVDAYNAME4 = &H34
 LOCALE_SABBREVDAYNAME5 = &H35
 LOCALE_SABBREVDAYNAME6 = &H36
 LOCALE_SABBREVDAYNAME7 = &H37
 LOCALE_SABBREVLANGNAME = &H3
 LOCALE_SABBREVMONTHNAME1 = &H44
 LOCALE_SCOUNTRY = &H6
 LOCALE_SCURRENCY = &H14
 LOCALE_SDATE = &H1D
 LOCALE_SDAYNAME1 = &H2A
 LOCALE_SDAYNAME2 = &H2B
 LOCALE_SDAYNAME3 = &H2C
 LOCALE_SDAYNAME4 = &H2D
 LOCALE_SDAYNAME5 = &H2E
 LOCALE_SDAYNAME6 = &H2F
 LOCALE_SDAYNAME7 = &H30
 LOCALE_SDECIMAL = &HE
 LOCALE_SENGCOUNTRY = &H1002
 LOCALE_SENGLANGUAGE = &H1001
 LOCALE_SGROUPING = &H10
 LOCALE_SINTLSYMBOL = &H15
 LOCALE_SLANGUAGE = &H2
 LOCALE_SLIST = &HC
 LOCALE_SLONGDATE = &H20
 LOCALE_SMONDECIMALSEP = &H16
 LOCALE_SMONGROUPING = &H18
 LOCALE_SMONTHNAME1 = &H38
 LOCALE_SMONTHNAME10 = &H41
 LOCALE_SMONTHNAME11 = &H42
 LOCALE_SMONTHNAME12 = &H43
 LOCALE_SMONTHNAME2 = &H39
 LOCALE_SMONTHNAME3 = &H3A
 LOCALE_SMONTHNAME4 = &H3B
 LOCALE_SMONTHNAME5 = &H3C
 LOCALE_SMONTHNAME6 = &H3D
 LOCALE_SMONTHNAME7 = &H3E
 LOCALE_SMONTHNAME8 = &H3F
 LOCALE_SMONTHNAME9 = &H40
 LOCALE_SMONTHOUSANDSEP = &H17
 LOCALE_SNATIVECTRYNAME = &H8
 LOCALE_SNATIVEDIGITS = &H13
 LOCALE_SNATIVELANGNAME = &H4
 LOCALE_SNEGATIVESIGN = &H51
 LOCALE_SPOSITIVESIGN = &H50
 LOCALE_SSHORTDATE = &H1F
 LOCALE_STHOUSAND = &HF
 LOCALE_STIME = &H1E
 LOCALE_STIMEFORMAT = &H1003
End Enum
Public Function Get_locale(RSValue As LOCAL_INFO) ' Retrieve the regional setting

     Dim Symbol As String
     Dim iRet1 As Long
     Dim iRet2 As Long
     Dim lpLCDataVar As String
     Dim Pos As Integer
     Dim Locale As Long
     
     Locale = GetUserDefaultLCID()

'LOCALE_SDATE is the constant for the date separator
'as stated in declarations
'for any other locale setting just change the constant

'Function can also be re-written to take the
'locale symbol being requested as a parameter
     
     iRet1 = GetLocaleInfo(Locale, RSValue, _
     lpLCDataVar, 0)
     Symbol = String$(iRet1, 0)
     
     iRet2 = GetLocaleInfo(Locale, RSValue, Symbol, iRet1)
     Pos = InStr(Symbol, Chr$(0))
     If Pos > 0 Then
          Symbol = Left$(Symbol, Pos - 1)
          Get_locale = "Regional Setting = " + Symbol
     End If

End Function

Public Function Set_locale(RSValue As LOCAL_INFO) 'Change the regional setting

     Dim Symbol As String
     Dim iRet As Long
     Dim Locale As Long
     
'LOCALE_SDATE is the constant for the date separator
'as stated in declarations
'for any other locale setting just change the constant

'Function can also be re-written to take the
'locale information being set as a parameter

     Locale = GetUserDefaultLCID() 'Get user Locale ID
     Symbol = "-" 'New character for the locale
     iRet = SetLocaleInfo(Locale, RSValue, Symbol)
   
End Function

'****** end of bas file ******************

please maintain

Questions Asked 12
Last 10 Grades Given B A A A A  
Question Grading Record 5 Answers Graded / 5 Answers Received
This question appears to be abandoned. A question regarding it will be left in the Community Support
area; if you have any comment about the question, please leave it here.

Unless there is objection or further activity, one of the moderators will be asked to accept the comment
of <hongjun >.

The link to the Community Support area is:
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt

DO NOT ACCEPT THIS COMMENT AS AN ANSWER.
Just for clarification since my english is ugly than my code:
Question is regarding language support for tooltips not custom one, isn't it?
The title and the text are saying different things!

I think it should be fair to splits points between <hongjun> (for the title) and <Richie_Simonetti> (for the text).
That's good to me.
Avatar of Moondancer
Moondancer

Thanks for your help.

Points split ...
Points for Richie_Simonetti -> https://www.experts-exchange.com/jsp/qShow.jsp?qid=20309564

ATTENTION bhatul -->  Please click the following link and BRING ALL YOUR OPEN QUESTIONS TO A CONCLUSION.  Administration will be contacting you in this regard if they remain open for another 7 days.  You have nine (9) questions to resolve.

https://www.experts-exchange.com/jsp/memberProfile.jsp?mbr=bhatul&showQHistory=true

Moondancer - EE Moderator