mytooltipctrl.cpp

来自「这是一个VC的界面编程,里面的程序大方美观,里面的思想值得学习」· C++ 代码 · 共 47 行

CPP
47
字号
// MyToolTipCtrl.cpp : implementation file
//

#include "stdafx.h"
#include "MyToolTipCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMyToolTipCtrl

CMyToolTipCtrl::CMyToolTipCtrl()
{
}

CMyToolTipCtrl::~CMyToolTipCtrl()
{
}


BEGIN_MESSAGE_MAP(CMyToolTipCtrl, CToolTipCtrl)
	//{{AFX_MSG_MAP(CMyToolTipCtrl)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyToolTipCtrl message handlers

BOOL CMyToolTipCtrl::AddToolTip(UINT nID, CRect lpRect, LPCTSTR lpszText)
{

	TOOLINFO Tips;
	lpRect.top = lpRect.top +50;
	memset(&Tips, 0, sizeof(TOOLINFO));
	Tips.cbSize = sizeof(TOOLINFO);
	Tips.hwnd = GetOwner()->GetSafeHwnd();
	Tips.uFlags = TTF_SUBCLASS;
	Tips.uId = nID;
	memcpy(&Tips.rect, lpRect, sizeof(RECT));
	Tips.lpszText = (LPSTR)lpszText;
	return (BOOL)SendMessage(TTM_ADDTOOL, 0, (LPARAM)&Tips);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?