webbrowser-control

Resizing custom user control according to data in the webBrowser control docked in it

一曲冷凌霜 提交于 2019-11-26 21:43:00
问题 I have a webBrowser control named webBrowser1 that is added and docked as DockStyle.Full on a custom user control. The web-browser accepts some HTML text dynamically and displays it. I disabled the scroll bars of the webBrowser control. My problem is that whenever the content is somewhat lengthy, the webBrowser hides it from below. But the requirement of my project objective is that the webBrowser must not show either scroll bars or it should not hide some of the content. The content must be

How might I create and use a WebBrowser control on a worker thread?

廉价感情. 提交于 2019-11-26 21:42:10
问题 I am creating an application that does screen shots of websites using the following method http://pietschsoft.com/post/2008/07/C-Generate-WebPage-Thumbmail-Screenshot-Image.aspx I tried to make the application multithreaded but I have run into the following error: [ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment.] Any suggestions how to fix this issue? My code is basically as follows: List<string>

Workaround BeforeNavigate2 not being fired in WPF .NET

别说谁变了你拦得住时间么 提交于 2019-11-26 21:41:26
问题 I need to send headers with every request I transmit using the System.Windows.Controls.WebBrowser control. Using C# with .Net, due to a bug described here, the BeforeNavigate2 event, which would help me with call-by-reference-parameters, is not being fired, and the BeforeNavigate event described in the bug report does not help me, as its parameters are read only. The Solution described here are difficult to impossible to use as I have a lot of references to the Controls Web Browser that would

How programmatically submit a form without a submit button in WebBrowser

孤街浪徒 提交于 2019-11-26 21:20:34
问题 I navigated to a website with a form that has no submit button but does have form. I would like to submit this form. How to do this using C# and WebBrowser control? 回答1: Try this (or something like it): HtmlElementCollection elements = this.webBrowserControl.Document.GetElementsByTagName("Form"); foreach(HtmlElement currentElement in elements) { currentElement.InvokeMember("submit"); } 来源: https://stackoverflow.com/questions/1539685/how-programmatically-submit-a-form-without-a-submit-button

How to invoke scripts work in msHTML

 ̄綄美尐妖づ 提交于 2019-11-26 21:10:23
I'm using axWebBrowser and I need to make a script work which works when selected item of a listbox is changed. In default webBrowser control there is a method like; WebBrowserEx1.Document.InvokeScript("script") But in axWebBrowser I can not work any script! And there is no documentation about this control. Anyone knows how ? A late answer, but hopefully still may help someone. There is a number of ways to invoke a script when using WebBrowser ActiveX control. The same techniques can also be used with WinForms version of WebBrowser control (via webBrowser.HtmlDocument.DomDocument ) and with

Uploading Files Not Working - Need Assistance

♀尐吖头ヾ 提交于 2019-11-26 21:06:37
I am trying to upload a file (an image) using the WebBrowser control. Can't seem to do it and need some help. Here is the Html: <form action="https://post.testsite.com/k/IOkurrwY4xGI_EJMbjF5pg/zMNsR" method="post" enctype="multipart/form-data"> <input type="hidden" name="cryptedStepCheck" value="U2FsdGVkX18yNzEwMjcxMJdrv2IidjtpGSCPzHNblWk02eJAJ6DFXFXic-Am1lTPMYL7k7XDoH0"> <input type="hidden" name="a" value="add"> <input class="file" type="file" name="file" multiple="multiple"> <button class="add" type="submit" name="go" value="add image">add image</button> </form> Here is the C# code...

WebBrowser print settings

青春壹個敷衍的年華 提交于 2019-11-26 21:06:34
How ca i change my html document orientation(to Landscape) for printing using WebBrowser control. var browser = new WebBrowser(); browser.DocumentCompleted += (sender, args) => { var ws = sender as WebBrowser; //change paper size and orientation ws.Print(); }; browser.Navigate(path); I need to change paper size format to C5 and orientation to Landscape before printing. How can i do this without any dialogs? noseratio To control HTML printing layout beyond @media CSS with WebBrowser (both WinForms and WPF), you would need to implement your own Internet Explorer Print Template . That would

The notorious yet unaswered issue of downloading a file when windows security is required

∥☆過路亽.° 提交于 2019-11-26 21:04:16
There is a web site: http://site.domain.com which prompts for credentials with "windows security" dialog box. So I managed to use WebBrowser control to navigate to the page and send keystrokes to enter the password - I could not find another way around. Now I came to the point where the website generates a link to a file I want to download, it looks like: http://site.domain.com/operations/reporting/csv/Report720_2553217.csv I tried to use WebClient to download the file but it does nothing (br is my WebBrowser control): WebClient wb = new WebClient(); wb.Headers.Add( br.Document.Cookie); wb

How do I add a local script file to the HTML of a WebBrowser control?

a 夏天 提交于 2019-11-26 21:01:29
问题 This seems really dumb. I've tried a bunch of different ways and it's just not working. I have a WinForms app with a WebBrowser control. If I try with a raw html file on my desktop using the same src string, the src I put together works fine. But plugging the same stuff into the WebBrowser control won't work. Here's my code: HtmlElementCollection head = this.wbPreview.Document.GetElementsByTagName( "head" ); if (head != null) { HtmlElement elm = this.webBrowserControl.Document.CreateElement(

WinForms - How do I execute C# application code from inside WebBrowser control?

夙愿已清 提交于 2019-11-26 20:30:00
问题 I have a form containing a web browser control. This browser control will load some HTML from disk and display it. I want to be able to have a button in the HTML access C# code in my form. For example, a button in the HTML might call the Close() method on the form. Target platform: C# and Windows Forms (any version) 回答1: Look at the WebBrowser.ObjectForScripting property. Managed to get Google Maps talking to a windows forms application using this. 回答2: I've implemeted this in a few