views:

35

answers:

2

I have a label on my form which is used to display a path. Occasionally the path is too long to display, so I turned on AutoEllipsis, but it always seems to truncate the end of the string (which is the more relevant part in my particular case). Is there any way to get it to automatically truncate the beginning?

Is there another control that I can use to display the path?

+1  A: 

There is a project on The Code Project that looks like it does exactly what you want: Auto Ellipsis. There is a demo that you can download along with the source.

adrift
Seems like a lot of work... in Win32 there is already a function DrawText which can handle paths or word boundary truncation for you. I guess if I want this feature then I'll have to be prepared to implement it myself.
dreamlax
A: 

The easy way is do a trick by using textbox instead of label, just design it like a label then do this

textBox1.Enabled = false;  //so it will not be selectable like label
textBox1.SelectionStart = textBox1.Text.Length; //so it will focus on the last character on the textbox
Raymund