Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Path Ellipsis without Win32 API call

I have a long path I'd like to shorten for displaying on a form using the ellipsis character(s?).

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?

like image 242
Rezzie Avatar asked May 20 '26 05:05

Rezzie


1 Answers

Your own link has

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?

like image 105
Logan Capaldo Avatar answered May 22 '26 18:05

Logan Capaldo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!