Winform 获取相对路径 C#

///获取相对路径

///例如:System.Windows.Forms.Application.StartupPath = "E:\App\CheckingMachine\QueryMachine\bin\Debug"

/// 经过以下处理将返回"E:\App\CheckingMachine\QueryMachine\images\1.gif"

 

string path=System.Windows.Forms.Application.StartupPath + @"../../";  System.IO.Directory.SetCurrentDirectory(path); 

string strFilePath = System.IO.Directory.GetCurrentDirectory() + @"\images\1.gif";

posted on 2015-07-22 16:34  软件开发学习分享  阅读(272)  评论(0编辑  收藏  举报