我想检索“路径” html元素的“ d”属性值,并将其显示在文本框中(用于测试)。
我尝试了下面的代码,但是它找到了元素,但是没有添加到文本框中。
foreach(HtmlElement elm in col) {
if (elm.GetAttribute("className") == "highcharts-series") {
HtmlElementCollection col2 = elm.Children;
row = col2[0];
}
}
textBox1.Text += row.GetAttribute("d");
HTML元素:
<g class="highcharts-series" visibility="visible" zindex="0.1" transform="translate(30,325) scale(1 1)" clip-path="url(#highcharts-5)">
<path fill="rgba(69,114,167,0.05)" d="M150 0 L75 200 L225 200 Z" zindex="0"></path>
<path fill="none" d="M150 0 L75 200 L225 200 Z" stroke="#4572A7" stroke-width="1" zindex="1" stroke-linejoin="round" stroke-linecap="round"></path>
</g>