Use cpptooltip in VC to easily implement tooltip

Source: Internet
Author: User

Shao: cpptooltip is a great tooltip implementation. It supports HTML-lite statements, CSS style sheets, menus, toolbar, fade-in and fade-out, hyperlinks, animations, tables, and other powerful features. Body:

Download source code

 

Cpptooltip is a great tooltip implementation that supports HTML-lite statements, CSS style sheets, menus, toolbar, fade-in and fade-out, hyperlinks, animations, and tables.

 

 

1. Use cpptooltip Step 1: file reference

 

File Description
Pptooltip. h
Pptooltip. cpp
Cpptooltip class

Pphtmldrawer. h pphtmldrawer. cpp

Cpphtmldrawer class. Draw an HTML string in tooltip.

Ppdrawmanager. h
Ppdrawmanager. cpp

Cppdrawmanager class is a set of graph Processing Methods
Cexdib. h
Cexdib. cpp
For the ccexdib class, thanks to the provision of Davide pizzolato and Davide Calabro. This class implements background effects.

 

To use background Effects, You need to define use_shade: In ppdrawmanager. h.

 

To use background Effects, You need to define use_shade:

In ppdrawmanager. h # define use_shade

 

 

Ii. Basic usage of cpptooltip: Create a cpptooltip object

 

1 Cpptooltip m_tooltip;

Create a dialog box.Program, Which can be in oninitdialog

 

12 Cdialog: oninitdialog ();M_tooltip.create (This);

You can call addtool to register a tooltip for other controls, for example:

 

1 M_tooltip.addtool (getdlgitem (idc_button1), _ T ("Tooltip for idc_button1 control"));

You can add a tooltip for a region, for example:

 

1 M_tooltip.addtool (This, _ T ("Tooltip in the box"), Crect (100,100,200,200 ));

In addition, you need to use relayevent in pretranslatemessage to transmit the mouse message to the tooltip control.

 

1234 Bool ...: Pretranslatemessage (MSG * PMSG){M_tooltip.relayevent (PMSG );}
3. Add a tooltip for the toolbar. 1) create a cpptooltip object in the cmainframe header file:
1 Cpptooltip m_tooltip;
2) Call the addtoolbar method in cmainframe: oncreate:
123456789 Int Cmainframe: oncreate (maid){...M_tooltip.create (This);// Add a tooltip for the toolbar  M_tooltip.addtoolbar (& m_wndtoolbar );Return 0;}
3) Use relayevent to transmit the mouse message
1234 Bool Cmainframe: pretranslatemessage (MSG * PMSG){M_tooltip.relayevent (PMSG );}
4. Add a tooltip for the menu. 1) create a cpptooltip object in the cmainframe header file:
1 Cpptooltip m_tooltip;
2) Call the create method in cmainframe: oncreate:
1 M_tooltip.create (This);
3) cancel the comment line and enable the menu tool prompt in pptooltip. h.
1 # Define pptooltip_use_menu
4) add two messages to the cmainframe
12345678910 Void Cmainframe: onmenuselect ( Uint Nitemid, Uint Nflags, Hmenu Hsubmenu) { M_tooltip.onmenuselect (nitemid, nflags, hsubmenu ); Cframewnd: onmenuselect (nitemid, nflags, hsubmenu ); }   Void Cmainframe: onenteridle ( Uint Nwhy, cwnd * pwho) { M_tooltip.onenteridle (nwhy, pwho ); }
5) Use relayevent to transmit the mouse message
1234 Bool Cmainframe: pretranslatemessage (MSG * PMSG){M_tooltip.relayevent (PMSG );}

Cpptooltip also has many amazing features to be found.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.