日期:2014-05-18  浏览次数:21324 次

在winform窗体中显示PDF的问题
有datagridview控件,绑定了多个数组中的部分数据。
this.m_file = new string[]
{
"2002\\01\\0001.pdf",
"2002\\01\\0002.pdf",
"2002\\01\\0003.pdf",
"2002\\01\\0004.pdf",
  . 
  .
  .
  "2002\\05\\0008.pdf" };
  2002文件件里有(01、02、03、04......12)个子文件夹,01中有(0001.pdf、002.pdf.......)
 this.webBrowser1.Url = new Uri("E:\\2002\\01\\0001.pdf");这个能显示指定的pdf

现在我点击其中的一行(假如这一行在数组中的索引是i),那么,如何根据i把文件夹里的对应的pdf文件显示在webBrowser



------解决方案--------------------
webBrowser.Navigate(m_file[i],false)
------解决方案--------------------
System.IO;命名空间下的 目录 文件操作类(FileInfo File Directory)
------解决方案--------------------
代码如下:
C# code
string[] strPath = Directory.GetDirectories("E:\\2002");
                for(int i=0;i<strPath.Length; i++)
                {
                    DirectoryInfo di = new DirectoryInfo(strPath[i]);
                    FileInfo[] fi = di.GetFiles("*.pdf");
                    foreach (FileInfo f in fi)
                    {
                     MessageBox.Show(f.FullName);
                                        
                    }
                }