473,320 Members | 2,073 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

MultiLine ToolTips in designer- An Answer

VS2003

1) If you don't have one, add a tooltip control to your design canvas.
2) open the properties for the control that gets the tool tip
3) type in all your text in the 'tooltip on tooltip1' property.
The line feeds come later. The property editor has no way to enter
a \n. It doesn't parse and it doesn't accept control characters
escaped or not.
4) Switch from the design view to the form code.
e.g. 'MainFrm.cs' instead of 'MainFrm.cs[Design]'
5) Find the code that creates the control. It will be in the
InitializeComponent() method that you are NOT supposed to edit.
(More about that later)
6) Change the code for the tooltip from:
this.toolTip1.SetToolTip(this.someControl, "Line1Line2");
to:
this.toolTip1.SetToolTip(this.someControl, "Line1\nLine2");
7) Build and run. When the cursor floats over the control, you'll have 2 lines.
Do NOT look at the design page or examine properties.
8) Exit the solution (close it or save it, or open another, or exit VS)
9) Reopen the solution. Examine the properties for the control.
Tooltip on Tooltip 1 will say: "Line1[]Line2", AND
the linefeed will *stay* until you remove it, even if you edit/change
the design or properties.

Not only that, but the non-printable character '[]' that represents the line
feed in the tool tip text will copy and paste.

Explanation:

The InitializeComponent method is in a reserved region like this:
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>

....

#endregion

Whenever you are on the design page making changes, that region is
'empty'. Anytime you look at the page that has the code, or compile the
form, the design page generates code representing the current state
of the design and stuffs it in the region.

When and how are not material. The point is that the region is volatile
and will be re-written anytime the design view wants to (changes).

Now, I'm guessing, but it seems that when put away, the *code* is the
persistent backing for the design view of the form. So when you put
away the solution, and reload it, the design view is recreated from
the code. As a result, the tooltip on tooltip 1 text property now
has an embedded line feed character. The trick here, is that by changing
the 'region code' you have changed the persistent image of the form
without the knowledge of the design view.

This is a dirty trick, and I don't know how long it will last, but
it sure beats a stick in the eye. In the meantime, I have a copy/
pastable linefeed character that I can use in any of the properties that
accept text.

regards

bullshark

Nov 15 '05 #1
1 5835
Sweet! I had tried using \n in the tooltip to no avail, but was able to set
them at runtime. That upset me and I had to shorten many of my tooltips so
they wouldn't trail across the screen.

Nice job.

-Eric
Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Ei | last post by:
I'm working on a C# Windows Forms application that is leaking memory. I've been using the SciTech NetMem Profiler 2 (A really great tool, BTW) to track down leaks. I've found one related to...
1
by: Wayne Aprato | last post by:
Tooltips in Access have not worked on my machine for a long time despite several reinstalls of the operating system and applications at fairly regular intervals. I have finally pinned down the...
2
by: Greg Burns | last post by:
I added a toolbar to a form and added one button. I made sure ShowToolTips = true for the Toolbar, and have set a tooltip for the button. The problem is the tooltip only shows after clicking...
11
by: Steve Cutting | last post by:
Hi all, Using the toolbox I added a tooltip provider to my form, and set the text for each of my buttons using the properties window. When I first show the form using .showdialog the tooltips...
8
by: Mitchell Vincent | last post by:
I have a feeling this is something simple. I have a MDI app written in vb.NET - but no tooltips seem to be showing. Is there some "ShowTips" property that I need to be setting on each window? ...
7
by: Pieter | last post by:
Hi, I want to set the ToolTipText of a ToolStripButton (VB.NET 2005) on the MouseEnter-event. It works fine, unless I want to have a MultiLine toolTipText (with vbCrlf in it). Is there a way...
9
by: Alex | last post by:
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....
1
by: joostnews | last post by:
How can I prevent my tooltips from disappearing?? Problems I am having: - display-time should be much bigger so that people can take some time to read them. - I've also noticed that the tooltip...
3
by: =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= | last post by:
Hi, Is it possible to access menustrips and tooltips from the IDE when they are present on a form from which you have inherited? I would like to have a template form from which a bunch of forms...
2
by: Slickuser | last post by:
Hi, I have tried these methods but I never get a new line to show on check box tool tip? Any idea how to fix this? Thanks. string strFin = string.Empty; string str = "a b c d e f g";...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.