我需要將xml圖像路徑傳遞給位圖。我有一個xml文件,其中我使用了應用程序中使用的所有圖像路徑。以下是代碼。我得到無效的參數錯誤。將xml路徑傳遞給位圖時參數錯誤無效
protected void Button1_Click(object sender, EventArgs e)
{
XmlDocument xmldoc = new XmlDocument();
string file = HttpContext.Current.Server.MapPath("XMLFile1.xml");
xmldoc.Load(file);
string path = xmldoc.SelectSingleNode("ImagesXml/Ad/ImageUrl2").InnerText;
Bitmap b = new System.Drawing.Bitmap(xmldoc.SelectSingleNode("ImagesXml/Ad/ImageUrl2").InnerText);
Graphics g = Graphics.FromImage(b);
MemoryStream memStream = new MemoryStream();
g.SmoothingMode = SmoothingMode.AntiAlias;
}
在哪一行,你得到exception.Did你檢查什麼的innerText將返回 –
我得到這個 位圖B =新System.Drawing.Bitmap(xmldoc.SelectSingleNode( 「ImagesXml /廣告/ ImageUrl2」)。 InnerText); - >不能解引用表達式。指針無效 – user1665707