⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tooltipctrl.cpp

📁 3D reconstruction, medical image processing from colons, using intel image processing for based clas
💻 CPP
字号:
// ToolTipCtrl.cpp : implementation file//#include "stdafx.h"#include "fusion.h"#include "ToolTipCtrl.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// RxToolTipCtrl// static membersCString RxToolTipCtrl::m_strClassName;RxToolTipCtrl::RxToolTipCtrl(){}RxToolTipCtrl::~RxToolTipCtrl(){	if(m_hWnd)			DestroyWindow();}BEGIN_MESSAGE_MAP(RxToolTipCtrl, CWnd)	//{{AFX_MSG_MAP(RxToolTipCtrl)	ON_WM_PAINT()	//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// RxToolTipCtrl message handlersBOOL RxToolTipCtrl::Create(CWnd* pWndParent, BOOL bShadow){	// create our tooltip window but leave it invisible	// do we need to register the class?	if (m_strClassName.IsEmpty())	{		// first, create the background brush		CBrush  brBrush;		brBrush.CreateSolidBrush (::GetSysColor (COLOR_INFOBK));		// register the class name		m_strClassName = ::AfxRegisterWndClass (CS_BYTEALIGNCLIENT|CS_SAVEBITS|CS_HREDRAW|CS_VREDRAW,								0, (HBRUSH)brBrush.Detach ());    	if (m_strClassName.IsEmpty())			return 0;				// we're we successful?	}	// create the bubble window and set the created flag	CRect rect;	rect.SetRectEmpty();	HWND hwndParent = (pWndParent == NULL) ? NULL :	pWndParent->GetSafeHwnd();	if (!CreateEx (WS_EX_TOOLWINDOW, m_strClassName, _T (""), WS_POPUP,                           rect.left, rect.top, rect.right, rect.bottom, hwndParent, (HMENU)NULL))		return FALSE;	return TRUE;}void RxToolTipCtrl::OnPaint() {	CPaintDC dc(this); // device context for painting		// paint our text, centered in the window	CRect rect;	GetClientRect(rect);	dc.FillSolidRect(rect, ::GetSysColor(COLOR_INFOBK));	dc.Draw3dRect(rect, RGB(  0,  0,  0), RGB(  0,  0,  0));	// select our font and setup for text painting	CFont *pOldFont = (CFont *)dc.SelectStockObject(DEFAULT_GUI_FONT);	dc.SetBkMode(TRANSPARENT);	dc.SetTextColor(::GetSysColor(COLOR_INFOTEXT));	CString  strText;	GetWindowText(strText);	dc.DrawText (strText, rect, DT_SINGLELINE|DT_VCENTER|DT_CENTER);	dc.SelectObject(pOldFont);}//*******************************************************************************************void RxToolTipCtrl::Track(CPoint point, LPCTSTR lpszText){	if(m_ptLastPoint == point)			return;	// set the text	SetWindowText(lpszText);	CDC		*pDC = GetDC();	CFont	*pOldFont = (CFont *)pDC->SelectStockObject(DEFAULT_GUI_FONT);	CSize	szText = pDC->GetTextExtent(lpszText);	pDC->SelectObject(pOldFont);	ReleaseDC(pDC);	// move the window	SetWindowPos(&wndTop, point.x, point.y, szText.cx+6, szText.cy+4, SWP_NOACTIVATE);  	//-----------------------------------------------	// Adjust the window position by the screen size:	//-----------------------------------------------	CRect rectWindow;	GetWindowRect (rectWindow);	if (rectWindow.right > ::GetSystemMetrics (SM_CXFULLSCREEN))	{		point.x = ::GetSystemMetrics (SM_CXFULLSCREEN) - rectWindow.Width ();		SetWindowPos(&wndTop, point.x, point.y, 0, 0, SWP_NOSIZE|SWP_NOACTIVATE);	}	if (rectWindow.bottom > ::GetSystemMetrics (SM_CYFULLSCREEN) - 20)	{		point.y = ::GetSystemMetrics (SM_CYFULLSCREEN) - rectWindow.Height () - 20;		SetWindowPos(&wndTop, point.x, point.y, 0, 0, SWP_NOSIZE|SWP_NOACTIVATE);	}	m_ptLastPoint = point;    // show the window	ShowWindow(SW_SHOWNOACTIVATE);}//*******************************************************************************************void RxToolTipCtrl::Hide(){	// hide the bubble window	ShowWindow(SW_HIDE);}

⌨️ 快捷键说明

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