当前位置: 首页>>代码示例>>C++>>正文


C++ CListBox::ItemFromPoint方法代码示例

本文整理汇总了C++中CListBox::ItemFromPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ CListBox::ItemFromPoint方法的具体用法?C++ CListBox::ItemFromPoint怎么用?C++ CListBox::ItemFromPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CListBox的用法示例。


在下文中一共展示了CListBox::ItemFromPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: point

// The callback function that hooks up and processes messages
// send to the list-box within the combobox
LRESULT CALLBACK 
CTTComboBox::HookListboxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	CListBox* pList = (CListBox*)CWnd::FromHandle(hWnd);
	CTTComboBox* pThisCombo = NULL;
	m_mapCombo.Lookup(hWnd, pThisCombo);

	if (message == WM_MOUSEMOVE)
	{
		WORD xPos, yPos;
		xPos = LOWORD(lParam);
		yPos = HIWORD(lParam);
		CPoint point(xPos, yPos); 
		CRect rcClient;
		::GetClientRect(hWnd, &rcClient);
		if (rcClient.PtInRect(point))
		{// Handle mouse move event that may show a tool-tip window...
			CTTComboBox::HandleListboxMouseMove(pList, wParam, point);
		}
		else
		{// However, the list-box may be captured thus we must know when the mouse cursor
		 // out of the area of the list-box, and send 'WM_MOUSELEAVE' notification.
			::SendMessage(hWnd, WM_MOUSELEAVE, wParam, lParam);
		}

		if (!m_isEnter)
		{// Tracking the mouse event which are hovering and leaving.
			OnTrackMouseEvent(hWnd, TME_HOVER|TME_LEAVE);
			m_isEnter = TRUE;
		}
	}
	else if (message == WM_MOUSELEAVE)
	{
		// When the mouse cursor has been left current window, the original select of the list-box 
		// to reset LB_ERR.
		m_OriginalSel = LB_ERR;
		m_isEnter = FALSE;	
		// The tool-tip window is hidden
		m_tipWnd.ShowWindow(SW_HIDE);
	}
	else if (message == WM_CAPTURECHANGED)
	{	// Ignore the mouse capture changed...
		return 1;
	}
	else if (message == WM_LBUTTONDOWN || 
			 message == WM_LBUTTONDBLCLK)
	{
		WORD xPos, yPos;
		xPos = LOWORD(lParam);
		yPos = HIWORD(lParam);
		CPoint point(xPos, yPos); 
		CRect rcClient;
		::GetClientRect(hWnd, &rcClient);
		if (rcClient.PtInRect(point))
		{
			BOOL bOutside;
			int curSel = pList->ItemFromPoint(point, bOutside);
			if (!bOutside && curSel != LB_ERR)
			{
				for (int i = 0; i < pThisCombo->m_arrDisabledItems.GetSize(); i++)
				{
					if ((UINT)curSel == pThisCombo->m_arrDisabledItems.GetAt(i))
					{
						return TRUE; // Don't process the message
					}
				}
			}
		}
	}
	else if (message == WM_SHOWWINDOW)
	{
		if (wParam == TRUE) // Show up!
		{
			pThisCombo->AlignListBoxWithCombo();
		}
	}

	// Get previous window procedure
	WNDPROC oldListWndProc;
	m_mapWndProc.Lookup(hWnd, oldListWndProc);
	// Call previous window procedure
	return ::CallWindowProc(oldListWndProc, hWnd, message, wParam, lParam);
}
开发者ID:mazong1123,项目名称:TsubasaHack,代码行数:85,代码来源:TTComboBox.cpp


注:本文中的CListBox::ItemFromPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。