Multiline tooltip problem... shows the \n's

Multiline tooltip problem... shows the \n's

Post by Alex » Tue, 23 Jan 2007 02:40:43



Hi all -


Read here that embedding \n's into the tooltip string during runtime should
yeild multiline tooltips. However, mine is just keeping the \n's in there
and showing it all on one line.

Any idea how I get it to parse the control chars?

I'm doing something like this:

string slabelinfo = "line1\nline2";
toolTip1.SetToolTip(slabel1, slabelinfo );
 
 
 

Multiline tooltip problem... shows the \n's

Post by Danie » Tue, 23 Jan 2007 03:04:33

use this, \r\n:

string slabelinfo = "line1\r\n line2";
toolTip1.SetToolTip(slabel1, slabelinfo );

 
 
 

Multiline tooltip problem... shows the \n's

Post by Stefan Z C » Tue, 23 Jan 2007 03:10:49


Hi

Try also adding a carriage return character \r since the windows way is
really a combination of cr and lf (lf is just for *nix machines)

--
- Stefan Z Camilleri
- www.szc001.com
 
 
 

Multiline tooltip problem... shows the \n's

Post by Alex » Tue, 23 Jan 2007 03:36:53


I changed the \n to \n\r, but it still shows the \n\r in the same single
line.

"Stefan Z Camilleri" < XXXX@XXXXX.COM > wrote in
 
 
 

Multiline tooltip problem... shows the \n's

Post by Danie » Tue, 23 Jan 2007 03:50:27

i said \r\n not \n\r
 
 
 

Multiline tooltip problem... shows the \n's

Post by rossu » Tue, 23 Jan 2007 03:55:57


You may find that Environment.NewLine works better.

rossum
 
 
 

Multiline tooltip problem... shows the \n's

Post by Stefan Z C » Tue, 23 Jan 2007 04:19:51


Try inverting them, \r\n

--
- Stefan Z Camilleri
- www.szc001.com
 
 
 

Multiline tooltip problem... shows the \n's

Post by Alex » Tue, 23 Jan 2007 08:26:44


Tried the \r\n, but it stayed on one line. Switched the stored proc that
generates the string back to using \n and did a string.replace of \\n with
Environment.Newline and it replaced the \n with \r\n, but does give a
multiline tooltip.

Don't understand what the diff would be, but it works!

Thanks :)

rossum < XXXX@XXXXX.COM > wrote in
 
 
 

Multiline tooltip problem... shows the \n's

Post by Hans Kesti » Tue, 23 Jan 2007 20:44:03

> Tried the \r\n, but it stayed on one line. Switched the stored proc that

If a stored procedure generated a "\n" it would be a string of two
characters: '\' and 'n'.
If you use this inside a string literal in a C# program (string s =
"1\n2"), then the *real* string would be 3 characters, with the middle
one being a character with code 10. (Note that the de *** , trying to
be helpful, still will display the "\n").

So the "\n" from the stored procedure is just that, while a "\n" inside
C# is an escape-code for the newline character.


Hans Kesting
 
 
 

Multiline tooltip problem... shows the \n's

Post by Alex » Tue, 23 Jan 2007 22:26:24

Good to know - thx for the explanation!

I was thinking the tooltip display would parse the string for \n's, but now
I understand what's going on. Just needed the extra step of replacing the
\n's with newlines in the string then.

Hans Kesting < XXXX@XXXXX.COM > wrote in