Is there a simple way to create multi-line tool/tip text boxes ... nothing special, no balloons or anything, just multiple lines ???

A Combination of using the CreateWindowEX API, with a class of TOOLTIPS_CLASS, and then set it's style of TTS_ALWAYSTIP. The tooltip window would be a child of your form, and thence destroyed when you close your form..... Let's see...http://www.thescarms.com/vbasic/tooltip.asp

hi
you can use a picture box and a lable to exclude the form. because will be more less memory usage. draw a picture box (over the other contol) and put inside a label which will have you text with multip rows

pls sorry if i do not understand exactly what you want

Yeah, I think he was after a tooltip, like when you hold your mouse over a button and it tells you what it does.

This is a bit basic but might help.


pG

This is a bit basic but might help.

A bit basic! LOL That's a good one!!!! :D

See, BASIC is the language, so it struck me funny.... Oh, never mind!!

no pun intended :)

Is there a simple way to create multi-line tool/tip text boxes ... nothing special, no balloons or anything, just multiple lines ???

Doesn't look like it. I tried an obvious way -- at least to me -- and it didn't work. In form load change the tooltip using

Text1.ToolTipText = "this is another test" + vbCrLf + "the second line"

Didn't work... The tooltip 'parser' doesn't process vbcrlf as a CR-LF. They are undefined characters so they came out as boxes.

I wrote this class a while back since I wanted lenghty tooltip descriptions:

///<summary>

/// Summary description for WordWrap.

///</summary>

public class WordWrap

{
static private string _newLine = Environment.NewLine;
///<summary>

/// Get the wrapped version of the submitted text

///</summary>

///<param name="sText">Text to word wrap</param>

///<param name="iMaxLength">Maximum length per line in characters</param>

///<returns>The wrapped text</returns>

static public string Wrap(string sText,int iMaxLength)
{
string sWrappedText = "";
string sLine = "";
while (sText.Length>0)
{
if (sText.Length>=iMaxLength)
{
sLine = sText.Substring(0,iMaxLength);

if (sLine.EndsWith(" ")==false )
sLine = sLine.Substring(0,1+sLine.LastIndexOf(" "));

sWrappedText += sLine + _newLine;
}
else

{
sLine = sText;
sWrappedText += sLine;
}
sText = sText.Substring(sLine.Length);
}
return sWrappedText;
}
}

You setup a tooltip like this if you want to use the wordwrapping:

this.ttHelp.SetToolTip(this.lblDeposit2HourValue, WordWrap.Wrap("The average deposit per item on a 2 hour auction. Click to edit the stored value if not using average. Please leave at -1c if not known. (This figure is based on Sales, so if you don't have any sales then it won't know what the deposit is. If you've put something up for auction and it failed to sell then it will remember the deposit used then.) This value if entered will be set across all servers.",50));

Wow, that's uh, the wrong language.

Sorry then :-) I quite often convert VB code to C#, simple enough usually, so I took it that it would be simple enough to convert the other way too ;-)

Ah sure.... assuming it was VB.net that logic would make sense.... but we are in Legacy VB ;)

Nice code, by the way. It's elegant, and tasteful.

@purplegerbil

Excellent contribution. I was using pictureboxes as containers for other purpose, but didn't think of this. Very creative and usefull.

Open a vb debug window and debug print "Line1" & vbcrlf & "Line2" which should output:
?"Line1" & vbcrlf & "Line2"
Line1
Line2

At the end of line1 there is an invisible character that can be highlighted and copied and pasted. Copy it and paste it in the tooltip text.
ToolTip="Line1
Line2"

The tootip property will wrap to the next line in the designer, but it will also display on 2 lines onmouseover.

hth

Al ";0)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.