当前位置: 动力学知识库 > 问答 > 编程问答 >

How to make Webbrowser control with black background in Windows Phone 7.1

问题描述:

I am using webbrowser control to show local html content, cause the the background-color of the html page is black.

When I using NavigateToString method to navigate to the webbrowser, the webbrowser's background become white immediately, after a white coming the html page, then the background become black.

It's a little disturbing. Consider providing the best UX, I want to implement that the default background of the webbrowser is black.

Thx in advance.

网友答案:

Unfortunately this is a quirk of the WebBrowser control. I discovered the exact same issue when writing PhoneGap applications with WP7. The solution I came up with was to create a UI element that covers the WebBrowser control, wait for the content to be rendered, then fade out and hide the covering element, as described in this blog post.

网友答案:

Apply below code for your browser control.

public static readonly String StyleForBlackbody =
           "<style type='text/css'>\n" +
           " body {\n" +
           "   background-color : ??;\n" +           
           "   font-size:$$px; \n" +
           "   font-family: ##;\n" +          
           "   color: %%; \n" +
           "  };\n" +
           "</style>\n";

 public static String GetHtmlHead()
        {
            String html = StartHead;


                html += StyleForBlackbody;               
                html = html.Replace("??", "auto");                
                html = html.Replace("%%", "black");

        }

call above method.

分享给朋友:
您可能感兴趣的文章:
随机阅读: