Multi Line Tooltips
|
The Multi Line Tooltips demonstration project shows how to add a multi-line tooltip to entries of a ListView.
The code is based on the work of 10Tec Company which additionally offer a solution for adding tooltips to the header of a
ListView.
The project demonstrates how to add individual tooltips to the entries of a ListView. It extends the presented solution from 10Tec
Company by showing how to specify an individual tooltip based on the column the entry is in.
The style of the tooltip is Balloon style but can be changed easily.
The same technique could be used for adding multiline tooltips to all controls which offer a window handle, i.e. the TreeView control. Unfortunately,
the TreeView Control does not expose its window handle ...
|
|
Note:
Even if it sounds easy to apply such a tooltip to every control on a VBA user form, i.e. an image or a label, and even
if you find solutions in the Internet explaining this, it is not possible when using VBA. Solutions found were all for VB but not VBA.
In short words, such a solution will capture the MouseMove Event for the control of interest, obtain its window handle and assign the tooltip
to the window. A second MouseMove Event will be introduced for the User Form - it will be triggered in case the mouse is over the user form
but not over the control of interest. This event will destroy the tooltip.
The only problem is, those controls do not have a window handle. OK, you might think, the mouse cursor is still above the user form, so let us
use the user forms window handle to draw the tooltip on. Unfortunately, the user form consists of at least two windows - the first window, the window
which exposes its handle, is just the border of the user form inclusive its title bar. The inner part of the user form is a child window whose
handle cannot be obtained.
(Of course there is a way to get this window handle - but I do not know how)
Using the above technique, adding a tooltip to the user form, will display a tooltip - provided the control is very near to any border or the title bar and you
move the mouse pointer over either the border or the title. Therefore this is pretty useless ...
Anyhow, you can add tooltips to any control offering its window handle using technics described in this project. Showing Multi-Line Tooltips above
a listview works fine, at least.
Credits: 10Tec Company