Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I show a tooltip for the header area of a Winforms ListView control?

I can set the ToolTip property of a ListView control, but that's for the whole control.

Can I just have a tooltip for the Details View header area?

like image 916
RichieHindle Avatar asked Aug 24 '09 22:08

RichieHindle


1 Answers

ObjectListView (an open source wrapper around .NET WinForms ListView) supports tooltips on headers.

The functionality isn't very easy to replicate in a standard ListView, but I'll outline the steps necessary:

  1. get the header control of the ListView (using the LVM_GETHEADER message)
  2. create a tooltip that is just for the header. The standard .NET ToolTip class cannot do this, since it only works on full Controls, and you will only have a handle)
  3. listen for TTN_GETDISPINFO messages on your tooltip and fill in the NMTTDISPINFO structure appropriately.

It really much easier to use an ObjectListView, which makes a ListView much easier to use and much more functional. This snapshot shows a header tooltip that was dynamically generated in response to a HeaderToolTip event:

alt text

like image 176
Grammarian Avatar answered Oct 10 '22 06:10

Grammarian