Question How to prevent WebBrowser control from downloading images?

VBobCat

Well-known member
Joined
Sep 6, 2011
Messages
137
Location
S?o Paulo, Brazil
Programming Experience
3-5
Is there a way to set WebBrowser control not to download images while rendering HTML documents? That would help to speed up automation. Thank you very much!
 
First of all, thank you very much!

Second, well, I don't need to show the pages to user, but I do need to interact with them quite a lot, not just to read their content. So my best bet is keep decorative images from being downloaded and gain that time and network band.

Third, and please forgive if it is sort of an abuse, after I incorporate the Browser2 class into my project, how do I make the webBrowser control that is already in my form to "become" it? In other words, as far as I know (which is not much, sadly), a custom control is a class that inherits the regular control and adds it some new features, but I don't know how to get in design time it and put it in my Forms.

The further I've achived in that field was creating classes that provide custom data validation to TextBoxes, or easily populates and handles data in ComboBoxes. But I know that what I've done are not real custom TextBoxes or ComboBoxes. They're classes that receives a regular, existing controls as argument in their constructors and handles some of their events. So when I want to use them in a form, I declare a new instance of them inside Form's class and construct it passing a given TextBox or ComboBox (that was previously put in that form in design time) as argument. The class does the rest for me pretty well. I was quite happy when I got to do this, but I realize that custom controls are several steps beyond it.

And yes, these are rookie's questions, I'm aware of that. Sorry.

Kind regards, and thank you again.
 
how do I make the webBrowser control that is already in my form to "become" it?
By deleting it and adding the custom WebBrowser to your form instead. When you added the class(es) and recompiled project the 'Browser2' control, as it was called in this case, was added to Toolbox under project Components tab.
 
Yes, the new component appeared as predicted.
So, as for generalization, I ask: everytime I create a class that inherits an existing control and recompile, it will appear as new control type in the toolbox?
Thank you very much!!
 
So, as for generalization, I ask: everytime I create a class that inherits an existing control and recompile, it will appear as new control type in the toolbox?
Yes, unless you declare it nested within another class. Generally you should declare each new class in a new code file ('Add New Item...' and select one of the templates, or 'Add Class...').
 
Back
Top