I'm writing application with WPF WebBrowser
control. It's source is result of xml/xslt sourse from database.
In the window that contains WebBrowser
there is button for printing with handler:
mshtml.IHTMLDocument2 doc = WBrowser.Document as mshtml.IHTMLDocument2;
doc.execCommand("Print", true, 0);
but in this case there is no background in printed document. I've researched this issue, and it's trouble with property in Internet Explorer page setup dialog - Allow the printing of background colors and images.
I've tried to change this by this code:
RegistryKey regKey = Registry.CurrentUser
.OpenSubKey("Software", true)
.OpenSubKey("Microsoft", true)
.OpenSubKey("Internet Explorer", true)
.OpenSubKey("PageSetup", true);
var defaultValue = regKey.GetValue("Print_Background");
regKey.SetValue("Print_Background", "yes");
but this is bad code. I don't want to change registry values for one simple bool parameter.
So, my question is: how can I change this parameter programmatically via code-behind without registry modification?
Thank you!