da.swf 放到你程序的目录下.. 或则 你在你程序用FolderBrowserDialog来选择目录

解决方案 »

  1.   

    [Quote=引用 2 楼 zhoukang0916 的回复:]
    引用 1 楼 zgke 的回复:
    da.swf 放到你程序的目录下.. 或则 你在你程序用FolderBrowserDialog来选择目录 
     
    高手说的
      

  2.   

    AppDomain.CurrentDomain.BaseDirectory可以获取当前程序集的路径..然后自己计算出"绝对路径"就可以了
      

  3.   

    有两种方法:
    1、一种写程序用相对路径获取flash文件地址,
    比如你要用的flash文件在应用程序WinSite目录下,那么可以这样写其相对路径:
         string reportPath = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0,
         Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));
         reportPath += @"\(你的flash文件)";2、第二种方法,将你要用的flash文件放在应用程序WinSite下的资源文件中即Resources.resx
                string AppPath = Application.StartupPath;
                string RptFileFullName = AppPath + @"\(你的flash文件)";            ResourceManager resources = new ResourceManager(typeof(ZJFF.Properties.Resources));
                byte[] bytes = (byte[])resources.GetObject("(你的flash文件)");            if (File.Exists(RptFileFullName))
                    File.Delete(RptFileFullName);
                FileStream fileStream = new FileStream(RptFileFullName, FileMode.CreateNew);
                BinaryWriter binWriter = new BinaryWriter(fileStream);
                binWriter.Write(bytes, 0, bytes.Length);            binWriter.Close();
                fileStream.Close();
                reportPath = RptFileFullName;
     
      

  4.   

    第二种方法修正:
    将你要用的flash文件放在应用程序WinSite下的资源文件中即Resources.resx
                string AppPath = Application.StartupPath;
                string RptFileFullName = AppPath + @"\(你的flash文件)";            ResourceManager resources = new ResourceManager(typeof(WinSite.Properties.Resources));
                byte[] bytes = (byte[])resources.GetObject("(你的flash文件)");            if (File.Exists(RptFileFullName))
                    File.Delete(RptFileFullName);
                FileStream fileStream = new FileStream(RptFileFullName, FileMode.CreateNew);
                BinaryWriter binWriter = new BinaryWriter(fileStream);
                binWriter.Write(bytes, 0, bytes.Length);            binWriter.Close();
                fileStream.Close();
                reportPath = RptFileFullName; 
      

  5.   

    Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\")).Substring(0, Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));
      

  6.   


                //获取应用程序的当前工作目录。 
                String path1 = System.IO.Directory.GetCurrentDirectory();             
                MessageBox.Show("获取应用程序的当前工作目录:" + path1);             //获取程序的基目录。
                String path2 = System.AppDomain.CurrentDomain.BaseDirectory;         
                MessageBox.Show("获取程序的基目录:" + path2);             //获取和设置包括该应用程序的目录的名称。
                String path3 = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;             
                MessageBox.Show("获取和设置包括该应用程序的目录的名称:" + path3);             //获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称。
                String path4 = System.Windows.Forms.Application.StartupPath;            
                MessageBox.Show("获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称:" + path4);             //获取启动了应用程序的可执行文件的路径及文件名
                String path5 = System.Windows.Forms.Application.ExecutablePath;            
                MessageBox.Show("获取启动了应用程序的可执行文件的路径及文件名:" + path5);将flash文件放到你的应用程序目录
      

  7.   

    把文件放在应用程序目录下有很多方式来读取文件,
    可以有多种方式
    ==================
    通过调用Process.GetCurrentProcess().MainModule.FileName可获得当前执行的exe的文件名。
    Environment.CurrentDirectory
    Directory.GetCurrentDirectory()
    AppDomain.CurrentDomain.BaseDirectory
    Application.StartupPath
    Application.ExecutablePath
    Assembly.GetExecutingAssembly
    AppDomain.CurrentDomain.SetupInformation.ApplicationBase获取当前应用程序所在的路径。
    http://www.cnblogs.com/xingd/archive/2005/03/21/123152.html
    System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() 
      

  8.   

    引用的时候都尽量使用相对路径,方便移动,将你的da.swf放入你工程的根目录下,引用的地方,路径使用。
    ./da.swf, 也可以新建个文件夹来存放da.swf,路径相应的为  ./文件夹名/da.swf