Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 将image设置为Itextsharp.text.cell将引发错误_Vb.net_Itextsharp - Fatal编程技术网

Vb.net 将image设置为Itextsharp.text.cell将引发错误

Vb.net 将image设置为Itextsharp.text.cell将引发错误,vb.net,itextsharp,Vb.net,Itextsharp,将图像设置到单元格时出现问题 Dim CellAux As PdfPCell CellAux = New PdfPCell(Image.GetInstance("../../Common/Images/image_logo.gif")) 并引发下一个错误:找不到路径c:\windows\Common\Images\image\u logo.gif 为什么要在那里寻找图像 如何在正确的目录中搜索图像?运行应用程序时,始终从工作目录运行。这不一定是您期望的目录。在任何情况下,您都在代码中使用相对路

将图像设置到单元格时出现问题

Dim CellAux As PdfPCell
CellAux = New PdfPCell(Image.GetInstance("../../Common/Images/image_logo.gif"))
并引发下一个错误:
找不到路径c:\windows\Common\Images\image\u logo.gif

为什么要在那里寻找图像


如何在正确的目录中搜索图像?

运行应用程序时,始终从工作目录运行。这不一定是您期望的目录。在任何情况下,您都在代码中使用相对路径,绝对路径将使用该相对路径与您的工作目录组合来构造。本例中的结果是c:\windows\Common\Images\image\u logo.gif