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
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:
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:
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.