Winform 获取相对路径 C#

///获取相对路径

///例如:System.Windows.Forms.Application.StartupPath = "E:AppCheckingMachineQueryMachineinDebug"

/// 经过以下处理将返回"E:AppCheckingMachineQueryMachineimages1.gif"

 

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

string strFilePath = System.IO.Directory.GetCurrentDirectory() + @"images1.gif";

原文地址:https://www.cnblogs.com/DTWolf/p/4667863.html