PDA

View Full Version : How do I change the font size in WebBrowser module



jjcmmgb
27-05-2011, 23:39
Hi there
I'm working in a thinbasic application that simulate a mosaic of x websites shown at the same time in my screen (similar to the thumbnail tab's screen shown in IE8)
Is there any way to reduce the text size in every WebBrowser control?
How can I carry out the same effect through programming than when pressing Ctrl and + to increase or Ctrl & - to decrease the font size either in IE8 or Firefox

Thanks a lot

Regards

ErosOlmi
28-05-2011, 07:57
Hi jjcmmgb,

I didn't add that feature as native option but I will add in future release. I've created a feature request in support: http://www.thinbasic.com/community/project.php?issueid=286

I will check if in the meantime I can find a work around.

Ciao
Eros

jjcmmgb
28-05-2011, 10:46
Many thanks Eros
I'm glad to contribute to improve wonderful thinbasic's features :-)

ErosOlmi
28-05-2011, 11:23
Thanks a lot.

There was a project in the past about rendering browser image that maybe can interest you:

http://www.thinbasic.com/community/showthread.php?8852-Win-captute-with-BitBlt-and-PrintWindow-and-Opengl-examples&highlight=browser

ErosOlmi
29-05-2011, 23:52
Dear jjcmmgb,

I need confirmation about something I develop based on your request. Should work for IE 7 or above.
Please download attached thinBasic_UIAdv.dll module and place into your \thinBasic\Lib\ directory replacing your current thinBasic_UIAdv.dll

This new thinBasic_UIAdv.dll module implements the following new function:

WebBrowser_zoom hWnd, CtrlID, ZoomPct

where:
hWnd: is the main window containing your web control
CtrlID: is the control id you assigned for creating your web browser control
ZoomPct: is the zoom percentage, parameter in the range of 10 to 1000

Let me know if it works for you.

Ciao
Eros

jjcmmgb
30-05-2011, 15:06
Eros

I've installed the new UIAdv module in the Lib folder and tested it according to your instructions.
Please see here below a small part of the code tested where the WebBrowser_zoom command has been included so the result has been the same, full (100%) size screen despite I've not got any error message from ThinAir (and I tried to put the code before and after of WebBrowser_create command)
Is there any parameter I forgot to properly set it up?
Thanks

****
SELECT CASE cbMsg

CASE %WM_INITDIALOG

lState = INI_GetKey($Ini_FullPath, $Ini_Section_General, $Ini_Section_General_IsMaximized, "0")
if lState = 1 then
dialog show state cbhndl, %SW_MAXIMIZE
end if

dialog set minsize cbhndl, 360, 150

dialog get client cbhndl to w, h

'WebBrowser_zoom CBHNDL, %IDC_Web, 10
WebBrowser_Create CBHNDL, %IDC_Web, "http://www.google.es", 0, 1, 800, 600
WebBrowser_zoom CBHNDL, %IDC_Web, 10

jjcmmgb
30-05-2011, 22:23
Eros,

I've tried with the following code but no results, I set ZoomPct in a range from 10 to 1000.
Am I setting properly the parameters?
Thanks

****
SELECT CASE cbMsg

CASE %WM_INITDIALOG

lState = INI_GetKey($Ini_FullPath, $Ini_Section_General, $Ini_Section_General_IsMaximized, "0")
if lState = 1 then
dialog show state cbhndl, %SW_MAXIMIZE
end if

dialog set minsize cbhndl, 360, 150

dialog get client cbhndl to w, h

'WebBrowser_Create CBHNDL, %IDC_Web, "", 0, 1, -1, -1
WebBrowser_Create CBHNDL, %IDC_Web1, "http://www.google.es", 0, 1, 480, 510
webbrowser_zoom CBHNDL, %IDC_Web1, 10
WebBrowser_Create CBHNDL, %IDC_Web2, "http://www.yahoo.es", 481, 1, 480, 510
webbrowser_zoom CBHNDL, %IDC_Web2, 10
WebBrowser_Create CBHNDL, %IDC_Web3, "http://www.tv3.cat", 961, 1, 480, 510
webbrowser_zoom CBHNDL, %IDC_Web3, 10
WebBrowser_Create CBHNDL, %IDC_Web4, "http://www.rtve.es", 1441, 1, 480, 510
webbrowser_zoom CBHNDL, %IDC_Web4, 10

jjcmmgb
31-05-2011, 14:04
Eros

not sure if you got my 2 last replies since I cannot see them in the post entry.
I wanted to let you know that I've tried the code you mentioned changing the UIAdv.dll but I did not succeed.
I type the webbrowser_zoom command before and after webbrowser_create with several zoompct numbers (between 10 and 1000).
Any clue what happen?

Thanks

jjcmmgb
31-05-2011, 14:06
Eros

Just a short piece of the code with the webbrowser_zoom
******
CASE %WM_INITDIALOG

lState = INI_GetKey($Ini_FullPath, $Ini_Section_General, $Ini_Section_General_IsMaximized, "0")
if lState = 1 then
dialog show state cbhndl, %SW_MAXIMIZE
end if

dialog set minsize cbhndl, 360, 150

dialog get client cbhndl to w, h

'WebBrowser_zoom CBHNDL, %IDC_Web, 10
WebBrowser_Create CBHNDL, %IDC_Web, "http://www.google.es", 0, 1, 800, 600
WebBrowser_zoom CBHNDL, %IDC_Web, 10

*****

ErosOlmi
31-05-2011, 15:13
Hi jjcmmgb,

it seems there is some problem related to when is the right time for the control to accept the zoom command.

Can you be so kind to run attached example and see if you can see reduction in zooming?
Also please let me know your Operating System and IE version.



References:

http://msdn.microsoft.com/en-us/library/aa752087(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/aa752117(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/ms691264(v=vs.85).aspx

ErosOlmi
31-05-2011, 15:16
not sure if you got my 2 last replies since I cannot see them in the post entry.

For some reasons your previous posts wento into "moderation" state.
I need to check security setting.

Please check my previous post

jjcmmgb
31-05-2011, 21:56
Eros

You got it!!!! :D

Works perfectly on this way!!!
If I then want to create a dialog window with many webbrowser control does that mean I have to set a timer for each of them?

Thanks

ErosOlmi
31-05-2011, 22:07
No.

The problem is that if you try to set zoom factor while the page is loading ... it fails.

I still need to understand what's going on. I just find code in .Net handling events ( http://social.msdn.microsoft.com/Forums/en/ieextensiondevelopment/thread/f4087aa9-50e9-4b9e-9eda-48f52df6a530 ) so I need to study it better.

Try the following example and let me know. I've added few button in order to let you better experiment.