webbrowser-control

How to print background image in webBrowser control

≯℡__Kan透↙ 提交于 2019-12-24 06:29:23
问题 I want to print the background-images through my web browser control. body { background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%20%3D%20%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20version%20%3D%20%271.1%27%20height%20%3D%20%27100px%27%20width%20%3D%20%27100px%27%3E%3Ctext%20transform%20%3D%20%27translate(20%2C%20100)%20rotate(-45)%27%20fill%20%3D%20%27rgb(245%2C45%2C45)%27%20font-size%20%3D%20%2720%27%3E%20watermark%20%3C%2Ftext%3E%3C%2Fsvg%3E"); } string styledDocTest =

Overriding window.location on Webbrowser Control

吃可爱长大的小学妹 提交于 2019-12-24 04:32:19
问题 This might seem a weird question, but is there a way to override the window.location without making the browser control navigate to it? The problem I am having is that i am injecting html code in the control, and the window.location is about:blank - causing errors on some javascript code. Trying to make them think they are in a URL other than about:blank 回答1: I've had success with Object.defineProperty() when document.documentMode >= 9 (IE9+). To get the WebBrowser control in IE9+ mode, I

Clearing the selection in a webbrowser control

徘徊边缘 提交于 2019-12-24 04:21:10
问题 I have a form with webbrowser control ,where i am coping all the TEXT(not html) data to clipboard For this the code snippet is :- webBrowser2.Document.ExecCommand("SelectAll", false, null); webBrowser2.Document.ExecCommand("Copy", false, null); I have written the above code under webBrowser2_DocumentCompleted . The problem is that the webpage in webbrowserControl appears with selection. I want to clear that selection after copy operation. Is there a way to do this or a command such as

Allow popups in WPF WebBrowser

血红的双手。 提交于 2019-12-24 04:01:49
问题 Is there a way to allow popups within embedded WPF WebBrowser control? I didn't manage to find someone elses solution, nor COM interface which enables allowing popups. I wouldn't like to change users registry settings or use similar invasive methods, as application is intended to be distributed through ClickOnce. 回答1: You can implement custom popups by handling NewWindow2 or NewWindow3 events sourced by the underlying WebBrowser ActiveX control. Below is a very basic example of how to do this

Using Read-Only Fields in a C# WebBrowser

亡梦爱人 提交于 2019-12-24 03:33:11
问题 I'm currently using a WebBrowser control in a C# WinForms application, and attempting to control some variability presented with this control. Basically, my users log in to a separate UI provided by my application, which then displays the WebBrowser control, navigates to a predetermined log-in URL, and then auto-fills the username and password fields on that page. However, in order to prevent unpredictable behavior in this WebBrowser control, I want to make these username and password text

How do I call the click function of an HTML button using the class name of the control or its value but not the ID?

白昼怎懂夜的黑 提交于 2019-12-24 03:09:59
问题 I'm creating a WPF application that opens a WebBrowser instance and get the HTML code ... I was calling the elements by ID for example: if the HTML is: <input type="text" name="company" id="company" value=""/> the C# code to add value to this element will be: wb.Document.GetElementById("company").SetAttribute("value", String.Format("{0}", Company)); where wb is an instance of the WebBrowser Class or if i have a button and need to click the Click event: <input type="submit" id="button1" /> the

Navigate WebBrowser on mouse click through binding

蓝咒 提交于 2019-12-24 02:07:27
问题 I have a WPF project using the MVVM model. In my View, I have set up an invisible WebBrowser named myWebBrowser which is used to perform actions on the net (it seems that when I create the WebBrowser dynamically it does not work as intended). I also have, in my View, a button which, when clicked, would normally launch a void action that is set up in the ViewModel. That's fine. The issue I am having is that I want that void to do some events such as: myWebBrowser.Navigate(url) myWebBrowser

How to test if Webbrowser gets a connection error when navigating to a new URL?

帅比萌擦擦* 提交于 2019-12-24 01:45:24
问题 I have a PC that loses the Internet connection every 5 minutes. (long to explain why). On the background I'm running a C# timer every 10 mins that does very simple stuff: WebBrowser bobo = new WebBrowser(); bobo.Navigate(url); while(bobo.ReadyState != WebBrowserReadyState.Complete){Application.DoEvents();} string responsestring = bobo.DocumentText.ToString(); bobo.Dispose(); // and then do some stuff with responsestring It is very important to make sure that bobo webbrowser DID have an

WPF WebBrowser events for HTTP errors?

人走茶凉 提交于 2019-12-24 00:06:55
问题 I have a WPF application and I'm using the WebBrowser control to display some content from a public website. Sometimes in weird edge cases when the network connectivity is flakey, the web browser will show the "This program cannot display the webpage" error page. Is there some way to listen to the WebBrowser to detect when this occurs, so I can load a placeholder? 回答1: You could try using the NavigationService from System.Windows.Controls.Frame as indicated in this MSDN forum post. The

System.Windows.Controls.WebBrowser, System.Windows.Threading.Dispatcher, and a windows service

て烟熏妆下的殇ゞ 提交于 2019-12-23 19:35:09
问题 I'm trying to render some html content to a bitmap in a Windows Service. I'm using System.Windows.Controls.WebBrowser to perform the render. The basic rendering setup works as a standalone process with a WPF window hosting the control, but as a service, at least I'm not getting the LoadCompleted events to fire. I know that I at least need a Dispatcher or other message pump looping for this WPF control. Perhaps I'm doing it right and there are just additional tricks/incompatibilities necessary