Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows phone 7 在HTML文件中加载PNG图像_Windows Phone 7_Windows Phone 7.1 - Fatal编程技术网

Windows phone 7 在HTML文件中加载PNG图像

Windows phone 7 在HTML文件中加载PNG图像,windows-phone-7,windows-phone-7.1,Windows Phone 7,Windows Phone 7.1,在我的Windows Phone7.1应用程序中,我从WebBrowser的本地路径加载HTML文件。为此,我 使用以下代码将PNG图像转换为base64格式,问题是图像路径的base64格式未在webbrowser中加载图像。 请帮帮我哪里出错了 string s = "data:image/jpg;base64,"; imgStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("NewUIChanges.Html

在我的Windows Phone7.1应用程序中,我从WebBrowser的本地路径加载HTML文件。为此,我
使用以下代码将PNG图像转换为base64格式,问题是图像路径的base64格式未在webbrowser中加载图像。 请帮帮我哪里出错了

string s = "data:image/jpg;base64,";
imgStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("NewUIChanges.Htmlfile.round1.png");
        byte[] data = new byte[(int)imgStream.Length];
        int offset = 0;
        while (offset < data.Length)
        {
            int bytesRead = imgStream.Read(data, offset, data.Length - offset);
            if (bytesRead <= 0)
            {
                throw new EndOfStreamException("Stream wasn't as long as it claimed");
            }
            offset += bytesRead;
        }
        base64 = Convert.ToBase64String(data);

        Stream htmlStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("NewUIChanges.Htmlfile.equity_built.html");
        StreamReader reader = new StreamReader(htmlStream);
        string htmlcontent = reader.ReadToEnd();
        htmlcontent = htmlcontent.Replace("round1.png", s + base64);


        wb.NavigateToString(htmlcontent);
string s=“数据:图像/jpg;base64”;
imgStream=Assembly.getExecutionGassembly().GetManifestResourceStream(“NewUIChanges.Htmlfile.round1.png”);
字节[]数据=新字节[(int)imgStream.Length];
整数偏移=0;
while(偏移量<数据长度)
{
int bytesRead=imgStream.Read(data,offset,data.Length-offset);

如果(bytesRead如果您没有错误,则
数据
包含您的图像,并且
htmlcontent
中存在
round1.png
,则可能是图像类型错误,请尝试以下操作:

string s = "data:image/png;base64,";