How to get relative path from absolute path

前端 未结 23 1853
既然无缘
既然无缘 2020-11-22 11:52

There\'s a part in my apps that displays the file path loaded by the user through OpenFileDialog. It\'s taking up too much space to display the whole path, but I don\'t want

23条回答
  •  难免孤独
    2020-11-22 12:49

    There is a Win32 (C++) function in shlwapi.dll that does exactly what you want: PathRelativePathTo()

    I'm not aware of any way to access this from .NET other than to P/Invoke it, though.

提交回复
热议问题