0

Our custom Windows (C#) application uses the .net "System.Windows.Forms.WebBrowser" control to display HTML-based help. When I view a Help page in any browser, (IE, Chrome, Firefox, etc.), a box shadow appears on IMG elements. But when the help pages are displayed in the application using the IE control, the shadows don't appear. I cannot figure out why there's a difference.

The CSS for the box shadow is this:

img {
box-shadow: 6px 6px 15px 0 rgb(179,179,179);
-moz-box-shadow: 6px 6px 15px 0 rgb(179,179,179);
-webkit-box-shadow: 6px 6px 15px 0 rgb(179,179,179);
}

The CSS also has a media rule that turns off box-shadow when the page is printed.

@media print {
img {box-shadow: 0 0 0 0 #FFFFFF}
} 

I have IE 11 (11.0.9600.19572) installed on my PC (Windows 7 64bit). The developers don't know why the control acts differently than the full browser. All the answers I've found by searching online just say you need an up-do-date IE installed on the system.

user8356
  • 155
  • 5
  • [How can I get the WebBrowser control to show modern contents?](https://stackoverflow.com/q/38514184/3110834) – Reza Aghaei Dec 20 '19 at 14:52
  • Thank you, that did not show up in any of my searching (?) – user8356 Dec 20 '19 at 14:53
  • Also about printing background images and styles, you may want to take a look at [How to print background image in webBrowser control](https://stackoverflow.com/a/58968460/3110834) – Reza Aghaei Dec 20 '19 at 14:55
  • Actually, now I see that I did find that information before, and I tried both the registry change and added the meta tag () to all my pages. In theory, it sounds great, but it actually did not work for box-shadow. This is a real puzzler. – user8356 Dec 20 '19 at 14:58
  • I tried all the suggested solutions in the linked post and all work fine. So I closed the question as duplicate. If you still experiencing some problem, please consider posting [MCVE] to reproduce the problem. – Reza Aghaei Dec 20 '19 at 16:22
  • The problem is not solved by a meta tag or registry change, as your post describes. IE 11, which I have installed, does not lack CSS capabilities vs. Edge, AFAIK. – user8356 Dec 20 '19 at 18:16
  • What I told is not based on a guess, I wrote a simple application, loaded a simple html file containing an image and the styles which you mentioned in the question. Also in the application, applied the registry setting using the code that you can find in the linked post and every thing worked as expected. In the second test, instead of applying the registry settings, I added `X-UA-Compatible` meta tag and again everything worked as expected. – Reza Aghaei Dec 20 '19 at 19:13

0 Answers0