C#路径省略号,而不Win32 API调用 [英] C# Path Ellipsis without Win32 API call

查看:151
本文介绍了C#路径省略号,而不Win32 API调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还有很长的路,我想缩短使用省略号(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?

这篇关于C#路径省略号,而不Win32 API调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆