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
// 获取父类路径