📄 ctooltip.cpp
字号:
#include "CToolTip.hpp"
#include <assert.h>
// Create our Tooltip
CToolTip::CToolTip(HINSTANCE Instance,CWnd& father)
{
Create(Instance,father);
}
bool CToolTip::Create(HINSTANCE Instance,CWnd& father)
{
if (ttw.IsOpen())
return false;
// Create the Tooltip window we will use
ttw.Create(0, TOOLTIPS_CLASS, (LPSTR) NULL, TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
father, CMenu(), Instance, NULL);
// If unsuccessful, exit now.
if (!ttw.IsOpen())
return false;
// Change some default values (Those ones seems better to me)
SetMaxTipWidth(200); // 200 pix seems right
SetAutoPopTime(20000); // 20 secs
return true;
}
bool CToolTip::Register(CWnd& control,LPTSTR Text)
{
TOOLINFO ti;
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
ti.hwnd = control.GetParent().GetHWND();
ti.uId = (UINT) control.GetHWND();
ti.hinst = 0;
ti.lpszText = Text;
return ttw.SendMessage(TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti) == TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -