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 :)
Printable View
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 :)
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
Thanks, ill have a look at them ;)
Thanks
True
Hey,
I have downloaded the sample code, and open it in Visual Studio 2008, and it works perfectly.
Attachment 75431
Can you provide some details as to why this isn't working for you?
Gary
Gary
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
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:
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.Code:public partial class MyBrowser : WebBrowser
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
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!
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
Okay will do ;) Thanks mate! :)
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! :)
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
I have try to do as you say, but when I call Zoom Funtion, it appear an error message showed in below image.
[IMG]http://i896.photobucket.com/albums/a...h_zoomTest.jpg[/IMG]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
Hey,
Can you explain the exact steps that you have taken to get to the place that you are?
Gary
First, I open the sample, set the output as class library
http://i896.photobucket.com/albums/a...ke288/test.jpg
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.
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
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!
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
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