Winform中获取文件的路径

winform中获取文件路径(注:下面这些方式需要放在根目录下,否则获取失败)

// 配置文件的目录
        //protected string Root = System.Windows.Forms.Application.StartupPath;  // 获取启动文件的信息,如:E:\C#Code\Sharing\Sharing\bin\Debug,等价于System.Environment.CurrentDirectory;和 System.IO.Directory.GetCurrentDirectory()
        //protected string _ExeRoot = System.Windows.Forms.Application.ExecutablePath;  // 获取启动文件的信息,如:E:\C#Code\Sharing\Sharing\bin\Debug\Sharping.exe

// 获取父类路径

猜你喜欢

转载自www.cnblogs.com/namejr/p/11469702.html