gosonic
asked on
How to determine Text Size In IE?
Using VB.net 2003 Windows forms - How do I determine which setting the user has selected for Text Size in IE. (In the IE Veiw menu where the user has the option to set Text Size to Largest, Larger, Medium,Smaller, Smallest. )
I am using - Dim IE As SHDocVw.InternetExplorer to obtain other properties like
IE.height, IE.LocationURL , etc, can this info be gathered from there also or is there some other indicator I should observe to tell if the user has changed the size of the text they view to something other than medium/default?
IE.Document.body.currentSt yle.fontsi ze always returns (small ) no matter the setting????
I found this example on EE to use with the webbrowser control - can anyone help translate this over to work with IE?
Function GetFontSize(WebCtl As WebBrowser) As String
Dim vFontSize As Variant
Call WebCtl.ExecWB(OLECMDID_ZOO M, OLECMDEXECOPT_DODEFAULT, 0, vFontSize)
Select Case vFontSize
Case 0
GetFontSize = "Smallest"
Case 1
GetFontSize = "Smaller"
Case 2
GetFontSize = "Medium"
Case 3
GetFontSize = "Larger"
Case 4
GetFontSize = "Largest"
End Select
End Function
Help please
I am using - Dim IE As SHDocVw.InternetExplorer to obtain other properties like
IE.height, IE.LocationURL , etc, can this info be gathered from there also or is there some other indicator I should observe to tell if the user has changed the size of the text they view to something other than medium/default?
IE.Document.body.currentSt
I found this example on EE to use with the webbrowser control - can anyone help translate this over to work with IE?
Function GetFontSize(WebCtl As WebBrowser) As String
Dim vFontSize As Variant
Call WebCtl.ExecWB(OLECMDID_ZOO
Select Case vFontSize
Case 0
GetFontSize = "Smallest"
Case 1
GetFontSize = "Smaller"
Case 2
GetFontSize = "Medium"
Case 3
GetFontSize = "Larger"
Case 4
GetFontSize = "Largest"
End Select
End Function
Help please
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
You welcome.
Thank You.
Thank You.
The following should work in VS2003 VB.net
'Get current font size
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Z As Object
IE.ExecWB(SHDocVw.OLECMDID
MsgBox("The current font size is " & Z)
End Sub
Function GetFontSize(ByVal WebCtl As SHDocVw.InternetExplorer) As String
Dim vFontSize As Object
IE.ExecWB(SHDocVw.OLECMDID
Select Case vFontSize
Case 0
GetFontSize = "Smallest"
Case 1
GetFontSize = "Smaller"
Case 2
GetFontSize = "Medium"
Case 3
GetFontSize = "Larger"
Case 4
GetFontSize = "Largest"
End Select
End Function
'Decrease font size
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Z As Object
IE.ExecWB(SHDocVw.OLECMDID
If Z > 0 Then
Z = Z - 1
Else
Z = 0
End If
IE.ExecWB(SHDocVw.OLECMDID
End Sub
'Increase font size
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim Z As Object
IE.ExecWB(SHDocVw.OLECMDID
If Z < 4 Then
Z = Z + 1
Else
Z = 4
End If
IE.ExecWB(SHDocVw.OLECMDID
End Sub
Let me know if this works for you.