2016-06-28 20 views
0

サイト全体のHTMLタグをダウンロードし、HtmlAgility.HtmlNodeCollection C#に割り当てました。今、私はHTMLのimage srcだけをフィルタリングしています。HtmlAgility.HtmlNodeCollectionの画像の高さと幅c#

これは私のコードです:だから

string responseFromServer = string.Empty; 
Uri url = new Uri(requestedURL); 
using (WebClient wc = new WebClient()) 
{ 
    responseFromServer = wc.DownloadString(url); 
} 
HtmlDocument htmlDoc = new HtmlDocument(); 
htmlDoc.LoadHtml(responseFromServer); 

、HtmlNodeCollectionクラスを使用して、イメージの高さと幅や素子高さと幅を取得する方法はありますか?

答えて

1

これを読む:
https://msdn.microsoft.com/en-us/library/system.windows.forms.htmldocument.images(v=vs.110).aspx
はお返事スタンレーのための "幅" と "高さ"

+0

おかげで "SRC" を交換してください。私はSystem.windows.forms.HtmlNodeCollectionではなくHtmlAgility.HtmlNodeCollectionを使用しています –

+0

誰かが既にそれに答えています:http://stackoverflow.com/questions/13782352/i-want-to-retrieve-the-width-and-height-of- html-element-with-htmlagilitypack –

+0

ありがとうスタンレー。その答えでは、html要素にwidth属性とheight属性がない場合は何も返しません。 –

関連する問題