首先读取当前路径,之后提取出父路径。。
string currentPath = Directory.GetCurrentDirectory();
DirectoryInfo dirInfo = Directory.GetParent(currentPath);
currentPath = dirInfo.ToString();
dirInfo = Directory.GetParent(currentPath);
currentPath = dirInfo.ToString() + @"\images\sky.jpg";
以上,用到了Directory和DirectoryInfo,需要包含以下语句:
using System;
using System.IO;