第一种方法

            HtmlElementCollection hc = webBrowser1.Document.GetElementsByTagName("img");
            HtmlElement h0 = null;
            foreach (HtmlElement h in hc)
            {
                if (h.OuterHtml.Contains("code.en.img.php"))
                {
                    h0 = h;
                    MessageBox.Show(h.OuterHtml.ToString());
                }

            }

            MessageBox.Show(h0.GetAttribute("src"));
            string imgurl = h0.GetAttribute("src");
            pictureBox1.ImageLocation = imgurl;



------------------------分割符---------------------------------
第二种方法
            HtmlElement he = webBrowser1.Document.Images[10];
            mshtml.IHTMLImgElement img = (mshtml.IHTMLImgElement)(he.DomElement);
            string a = img.src;

------------------------分割符---------------------------------
第三种方法

HttpWebRequest hwr = (HttpWebRequest)HttpWebRequest.Create("http://www.doudou.com/code.en.img.php");

            Bitmap bmp = new Bitmap(hwr.GetResponse().GetResponseStream());
            bmp.Save("L:\\test\\111.bmp", System.Drawing.Imaging.ImageFormat.Bmp);

 

posted on 2009-10-05 12:42  也风  阅读(776)  评论(0编辑  收藏  举报