如何在窗口电话7中的Web浏览器中设置图像宽度和高度?

时间:2011-07-11 09:13:08

标签: windows-phone-7

在我的项目中,当我开始链接时,http://从服务结构返回如下

将http添加到webrowser链接:

webBrowser.Source = new Uri(linkWeb);

我想在webbrowser中获取元素HTML!

如何获取图像的src并获取HTML中的图像链接?

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
<head>
    <title>Advertisement</title>
    <script type='text/javascript'>
        setTimeout('window.location.replace(\"http://ads.diadiem.com:80/www/delivery/afr.php?refresh=10&zoneid=89&loc=\")', 10000);
    </script>
    <style type="text/css">
        body
        {
            margin: 0;
            height: 100%;
            background-color: transparent;
            width: 100%;
            text-align: center;
        }

        img
        {
            height: 50;
            width: 480;
        }
    </style>
</head>
<body>
    <a href='http://ads.com:80/www/delivery/ck.php?oaparams=2__bannerid=405__zoneid=89__cb=5bdb20fd07__oadest=http%3A%2F%2Fdownload.com'
            target='_blank'>
        <img src='http://ads.com:80/www/images/452c68d165d715b0984216bbf60627c0.jpg'
            width='320' height='55' alt='' title='' border='0' />
    </a>
    <div id='beacon_5bdb20fd07' style='position: absolute; left: 0px; top: 0px; visibility: hidden;'>
        <img src='http://ads.com:80/www/delivery/lg.php?bannerid=405&amp;campaignid=94&amp;zoneid=89&amp;loc=file%3A%2F%2F%2FApplications%2FInstall%2FCE8AC0B7-9103-4BCD-B9DE-BC3C1D10D814%2FInstall%2F&amp;cb=5bdb20fd07'
            width='0' height='0' alt='' style='width: 0px; height: 0px;' />
    </div>
</body>

我想要

<img src='http://ads.diadiem.com:80/www/images/452c68d165d715b0984216bbf60627c0.jpg'
    width='320' height='55' alt='' title='' border='0' />

并设置高度和宽度,我想得到

href='http://ads.com:80/www/delivery/ck.php?oaparams=2__bannerid=405__zoneid=89__cb=5bdb20fd07__oadest=http%3A%2F%2Fdownload.com

1 个答案:

答案 0 :(得分:0)

假设代码中的linkWeb是图像的路径, 尝试:

webBrowser.NavigateToString("<html><body><img src='" + linkWeb + "' height='100' width='200'></body></html>");