Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text Problems in ToolStripMenuItem

Status
Not open for further replies.

Brent113

Programmer
Aug 13, 2003
67
US
Hello again,

I am programmatically creating ToolStripMenuItems and I have it all working except when I assign it text. I first pass a path to the PathEllipsis function to make it fit in a smaller space and then assign the return to the Text property.

My problem is that when I step through the code and check values I get correctly something like this:

.Text = "C:\Documents and Settings\...\asdf.txt"

But when I look at the menu it shows this:

"C:\Documents and Settings\...\asdf.txt r2\older3\folder4\asdf.txt"

where it first displays the shortened path followed by what's left of the full path.

I have no idea where it is even getting the full path because I never pass it that. Any ideas?

____________________________________________________________________________
There are only 10 types of people in the world. Those that know binary and those that don't

Brent
 
I guess for the record I'll say what I did to fix it.

I forgot that the TextRenderer.MeasureText makes a direct api call, and therefore you have to trim after the null char with something like:
Strings.left(result, instr(result, ControlChars.NullChar)-1)

____________________________________________________________________________
There are only 10 types of people in the world. Those that know binary and those that don't

Brent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top