webbrowser-control

Problems having content in webbrowser scale automatically in Windows Form Application

若如初见. 提交于 2019-12-10 10:44:28
问题 I'm trying to create a program which scrolls through files located on my computer and displays the files. This is working for me so far but I'm getting content in actual size so the webbrowser adds a scrollbar(obviously). I want the content to scale automatically so it fits in the webbrowser without having to scroll. Code: WebBrowser web = new WebBrowser(); System.Drawing.Rectangle workingRectangle = Screen.PrimaryScreen.WorkingArea; int heightWebcontrol = workingRectangle.Height / 100 * 85;

Disable Image loading on WebBrowser-Control C# .Net 2.0+

两盒软妹~` 提交于 2019-12-10 10:27:54
问题 I am using vs2008 and I would like to disable image loading on my webbrowser control but I dont see any solution except for the WebBrowserEX which doesn't seem outside of .net 1.1. Anyone know how to do this? Thanks! 回答1: you should replace its tag , give the following code a try var html = webBrowser.DocumentText; var newOne = Regex.Replace(html, "<img.*/>", "", RegexOptions.Multiline); webBrowser.DocumentText = newOne; 来源: https://stackoverflow.com/questions/1260615/disable-image-loading-on

Ignoring web browser SSL security alerts in console application

試著忘記壹切 提交于 2019-12-10 10:14:41
问题 I'm creating a console application that is able to remotely capture screenshots of websites. Everything is working except the fact that I can't avoid Certificate errors. Every time I get popup message that I'm unable to pass. I tried using: ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(ValidateServerCertificate); But it doesn't work. Also tried the solution found here: http://www.codeproject.com/Articles/31163/Suppressing-Hosted-WebBrowser

Browser control NavigateToString display HTML code instead of rendering page

…衆ロ難τιáo~ 提交于 2019-12-10 10:05:15
问题 I am developing a browser app using Windows Phone 8 browser control. The app download an external webpage using WebClient into a string in the background. Then the browser navigate to the content using webBrowser.NavigateToString(str); However, instead of rendering the page, the browser shows the HTML code. I thought since no changes were made to the string, NavigateToString should handle it seamlessly. Or perhaps I am missing something. So how do I display the HTML page instead of its code?

DocumentComplete event in Embedded IWebBrowser2 using write() method

不问归期 提交于 2019-12-10 08:31:27
问题 I've been looking hard for this but still have not found any solution. I'm using native win32 c++ (no MFC, ATL or .NET) I'm loading an html document with IHTMLDocument2->write(). I would like to get the event when the page is ready to show, meaning that all images and elements are downloaded and rendered. Following the embedded browser object from here embedded web control (IWebBrowser2), embedded javascript's onkeydown and onkeyup not firing and from here http://www.codeproject.com/Articles

Disable context menu in Internet Explorer control

泪湿孤枕 提交于 2019-12-10 04:17:26
问题 How do I disable the context menu in the IE WebBrowser control and instead perform custom handling of the right-click event in C#? 回答1: Actually: WebBrowser browser; browser.IsWebBrowserContextMenuEnabled = false; This pretty much tells the WebBrowser that the right-click context menu is not welcome. 回答2: WebBrowser browser; browser.Document.ContextMenuShowing += new HtmlElementEventHandler(MyCustomContextMenuMethod); 回答3: AddHandler Me.WebBrowser1.Document.ContextMenuShowing, AddressOf

Display PDF from a stream in a WebBrowser control

人走茶凉 提交于 2019-12-10 03:06:11
问题 How can I display a PDF document from a MemoryStream within a WebBrowser control? I've searched around and found I can simply navigate to a PDF file using: webBrowser1.Navigate(@"C:\Temp\ExportedPDF.pdf"); However I want to avoid saving the file anywhere, but I'm currently leaning towards using IsolatedStorage simply because I can't find any other method to get the stream into the browser control. 来源: https://stackoverflow.com/questions/3038043/display-pdf-from-a-stream-in-a-webbrowser

How to call and pass arguments to a JavaScript method in a page hosted by the .NET WebBrowser control in C#? [duplicate]

徘徊边缘 提交于 2019-12-10 00:26:52
问题 This question already has answers here : Closed 7 years ago . I want to call a JavaScript function through C#, using a WinForm's WebBrowser control. I've attempted to search however could not find anything which answers my question, only solutions which involved ASP.NET. Thank you in advance. Edit: This is the only question regarding this that I've found that actually has an answer that demonstrates how to call a JavaScript method with parameters, and also shows how to call a .NET function

MultiThreading WebBrowser Control C# STA [duplicate]

淺唱寂寞╮ 提交于 2019-12-09 18:22:44
问题 This question already has answers here : WebBrowser Control in a new thread (4 answers) Closed 4 years ago . I want to make 3 threads that each run the WebBroswer control. So I would like to use the ThreadPool to make things easy. for(int i = 0;i < 3;i++) { ThreadPool.QueueUserWorkItem(new WaitCallback(gotoWork), i)); } WaitAll(waitHandles); ....../ void gotoWork(object o) { string url = String.Empty; int num = (int)o; switch(num) { case 0: url = "google.com"; break; case 1: url = "yahoo.com"

c# webbrowser control does not navigate to another page

谁说胖子不能爱 提交于 2019-12-09 18:18:40
问题 I have a console application and i've defined a webbrowser inside it. Firstly, i navigate to a page and fill a login form and invoke the submit button to login. After that, i want to go to another page in the same site using the same webbrowser but it does not navigate to that page. instead, it navigates to the page that it's redirected after login. Here is my code for clarification; this code gives me the source code of www.websiteiwanttogo.com/default.aspx instead of product.aspx what is