zoukankan      html  css  js  c++  java
  • 获取图片的三种方法

    第一种方法

                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);

  • 相关阅读:
    POJ 1990 MooFest
    python的unittest測试框架的扩展浅谈
    星云測试- Android应用深度体检专业平台
    HDOJ 1507 Uncle Tom's Inherited Land*
    产品设计
    Linux网络编程--wireshark分析TCP包头的格式
    java读取中文分词工具(一)
    为datatable添加自增列
    Oracle 自己主动内存管理 SGA、PGA 具体解释
    TCP/IP基础
  • 原文地址:https://www.cnblogs.com/zzh1236/p/1578165.html
Copyright © 2011-2022 走看看