我还有很长的路,我想缩短使用省略号(S?)显示在窗体上。
I have a long path I'd like to shorten for displaying on a form using the ellipsis character(s?).
我知道有在 PathCompactPathEx
Win32 API调用,但我知道有一个内置的.NET等价的。我已经用它previously,但无法找到它了。任何提示,请?
I know there is the PathCompactPathEx
Win32 API call, but I know there is a built-in .NET equivalent. I have used it previously, but cannot find it any more. Any hints, please?
您自己的链接有
替代托管API:
System.Windows.Forms.TextRenderer.MeasureText(字符串,字体,大小,TextFormatFlags.ModifyString | TextFormatFlags.PathEllipsis);
Alternative Managed API:
System.Windows.Forms.TextRenderer.MeasureText(String, Font, Size, TextFormatFlags.ModifyString | TextFormatFlags.PathEllipsis);
在底部。那是你正在寻找什么?
at the bottom. Is that what you are looking for?