c# - Make WebBrowser control use linked stylesheet in DocumentText -


I display a WebBrowser control and text but it is not using the linked CSS, it's just plain Appears in the form of text. I like it a lot.

  webBrowser1.DocumentText = some_text;  

In some html, and rel = "stylesheet" href = "PF.css"> html with the rest

When I save some files in a file and the webbrowser has navigated it, then this is exactly webBrowser1.Navigate (@ "C: \ test.html "); and PF.css in C: \

I have put PF.css in my project folder, where all the square files are there.

How can I use Web browser controls / display my linked CSS file? I do not want to save my string in a file and then navigate.

Thanks

  mshtml. HTML document current document = (mshtml.HTMLDocument) webBrowser1.Document.DomDocument; Mshtml.IHTMLStyleSheet styleSheet = CurrentDocument.createStyleSheet ("", 0); Stream Reader Stream Reader = New Stream Reader (@ "C: \ PFCSS"); String Text = Stream Reader Readout (); StreamReader.Close (); StyleSheet.cssText = text;  

There is a way to do this, but whatever I read indicates webbrower control, unless you navigate to any file / url and there Includes. BTW You must add a ref for Microsoft.mshtml.

Perhaps the future versions of this control can handle link stylesheet ...


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -