|
-
Jan 7th, 2010, 06:45 AM
#1
Thread Starter
Junior Member
Webbrowser Zoom
I am making a smal webbrowser, and i want the page t be able to zoom, 50%, 100%, 150% and 200%. Does anybody know how to do this?
Thanks
-
Jan 7th, 2010, 06:59 AM
#2
Re: Webbrowser Zoom
Hey,
You might want to take a look at the following:
http://www.vbforums.com/showthread.php?t=506103
There are lot's of helpful hints in there.
As for your specific question....
Have a look here:
http://slingkid.blogsome.com/2007/04/13/ie-zoom/
Gary
-
Jan 7th, 2010, 07:05 AM
#3
Thread Starter
Junior Member
Re: Webbrowser Zoom
Thanks, ill have a look at them 
Thanks
True
-
Jan 7th, 2010, 07:13 AM
#4
Re: Webbrowser Zoom
Hey,
I have downloaded the sample code, and open it in Visual Studio 2008, and it works perfectly.

Can you provide some details as to why this isn't working for you?
Gary
Gary
-
Jan 7th, 2010, 09:03 AM
#5
Thread Starter
Junior Member
Re: Webbrowser Zoom
Well, it worked but, the point is, its not code you can use to learn. I couldnt find any thing that was decent to learn from. Could you pick out the bits that are needed?
Becuase i dont know!
True
Thanks
-
Jan 7th, 2010, 09:16 AM
#6
Re: Webbrowser Zoom
Hey,
What you are trying to do isn't built directly in the WebBrowser. The person who wrote that article has had to extend the functionality of the WebBrowser by creating his own implementation. He has created his own user control, called MyBrowser, which inherits from WebBrowser:
Code:
public partial class MyBrowser : WebBrowser
With that in place, you get all the functionality of the normal WebBrowser, but you can add more, or change existing. That is what he has done.
He has overriden the AttachInterfaces and DetachInterfaces methods, to provide the basis for the zoom functionality. Then he has provided a new public method called Zoom, which does that actual work.
In order to use this, you would need to replace your instance of a WebBrowser, with a MyBrowser. There are a few core concepts going on here, that you really need to become familiar with.
Gary
-
Jan 7th, 2010, 09:19 AM
#7
Thread Starter
Junior Member
Re: Webbrowser Zoom
Sounds wayyyy To hard for me....at my level and if rather miss it out until i can learn more.
This would be a very good tutorial... haha
Thanks though!
-
Jan 7th, 2010, 09:26 AM
#8
Re: Webbrowser Zoom
Hey,
Yeah, there is a bit to get your head round with that one, but something you can easily slot in later once you get your head around a few things.
I would highly recommend having a look at jmcilhinney's WebBrowser, the other link above. He is very good at what he does, and you can learn a lot from the way that he structures his code, and implements different aspects of the code.
Gary
-
Jan 7th, 2010, 09:29 AM
#9
Thread Starter
Junior Member
Re: Webbrowser Zoom
Okay will do Thanks mate!
-
Mar 21st, 2010, 09:20 AM
#10
New Member
Re: Webbrowser Zoom
anybody can send me the sample 's code? I have the same question but in VB.net and I don't want to install C#; I just want for reference.
Thanks so much!
-
Mar 21st, 2010, 10:18 AM
#11
Re: Webbrowser Zoom
Hey,
Welcome to the forums!!
You have two options.
1) Convert the code in the sample to VB.Net.
2) Take the source code in the example, compile it into a DLL, and reference that assembly in your project.
Either way, there is going to be a bit of work to do.
Gary
-
Mar 23rd, 2010, 03:17 AM
#12
New Member
Re: Webbrowser Zoom
I have try to do as you say, but when I call Zoom Funtion, it appear an error message showed in below image.
Code:
Imports ZoomBrowser
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myWebBrowser As New MyBrowser
myWebBrowser.Dock = DockStyle.Fill
myWebBrowser.Navigate("http://www.google.com")
myWebBrowser.Zoom(ZoomValue.Text)
Me.Controls.Add(myWebBrowser)
End Sub
End Class
[IMG] [/IMG]
-
Mar 23rd, 2010, 06:56 AM
#13
Re: Webbrowser Zoom
Hey,
Can you explain the exact steps that you have taken to get to the place that you are?
Gary
-
Mar 23rd, 2010, 09:53 AM
#14
New Member
Re: Webbrowser Zoom
First, I open the sample, set the output as class library

then I create a new VB project and add reference as zoombrowser.dll
Drag a combobox named "ZoomValue", set value as " 50 75 100 125 150 ", default value as 75
Write code ...
just after I had added zoom funtion, the problem appeared.
-
Mar 23rd, 2010, 10:36 AM
#15
Re: Webbrowser Zoom
Hey,
Looks to me that you have set your class library project as the Startup Project, which is causing the error that you have shown.
Have you got another project in your solution? If so, set that as the Startup Project.
Also, I was expecting that you would create your own Class Library Project, and copy and paste the relevant sections of code, not directly change the existing project.
Gary
-
Mar 25th, 2010, 11:35 AM
#16
New Member
Re: Webbrowser Zoom
it seem to be impossible to create a class library using System.windows.Forms class! System.Drawing as well.
Can you test this and show me the result?
Thank you at all!
-
Mar 26th, 2010, 03:55 AM
#17
Re: Webbrowser Zoom
Hey,
You would simply need to add a reference to this assembly.
I don't actually think you would need this reference though, as you aren't creating a form.
I could be wrong though, as it has been a while this I have looked at that code.
Gary
-
Jun 29th, 2012, 12:43 PM
#18
New Member
Re: Webbrowser Zoom
Does anyone still have the sample code?!
link requires password... 
I have exactly the same issue at hand, I'd love to get my hands on the specific implementation of WebBrowser : MyBrowser... it seems to be exactly what I'm looking for.
PS: I'm working in C# (I know that's not this forms intent, but I thought I'd share this as the Sample Code seems to also be in C#) 
Hopefully ppl are still "out there"!!
Cheers,
MV
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|