//光标消息
BOOL CFaceItemSelectWnd::OnSetCursor(CWnd * pWnd, UINT nHitTest, UINT uMessage)
{
	//获取光标
	CPoint MousePoint;
	GetCursorPos(&MousePoint);
	ScreenToClient(&MousePoint);

	//点击判断
	WORD wLastFaceID=m_wSelectFace;
	WORD wHoverFaceID=MouseHitTest(MousePoint);

	//相同判断
	if (wHoverFaceID!=m_wSelectFace)
	{
		//变量定义
		CClientDC ClientDC(this);

		//设置变量
		m_wSelectFace=wHoverFaceID;

		//清理选择
		if (wLastFaceID!=INVALID_WORD)
		{
			//计算位置
			INT nXPos=m_nXExcursion+wLastFaceID%m_nWidthCount*(FRAME_WIDTH+FACE_CX);
			INT nYPos=TOP_PELS+wLastFaceID/m_nWidthCount*(FRAME_HEIGHT+FACE_CY)-m_nCurrentPos;

			//绘画头像
			DrawFaceItem(&ClientDC,wLastFaceID,nXPos,nYPos,false);
		}

		//绘画选择
		if (m_wSelectFace!=INVALID_WORD)
		{
			//计算位置
			INT nXPos=m_nXExcursion+m_wSelectFace%m_nWidthCount*(FRAME_WIDTH+FACE_CX);
			INT nYPos=TOP_PELS+m_wSelectFace/m_nWidthCount*(FRAME_HEIGHT+FACE_CY)-m_nCurrentPos;

			//绘画头像
			DrawFaceItem(&ClientDC,m_wSelectFace,nXPos,nYPos,true);
		}
	}

	//设置光标
	if (m_wSelectFace!=INVALID_WORD)
	{
		SetCursor(LoadCursor(GetModuleHandle(AVATAR_CONTROL_DLL_NAME),MAKEINTRESOURCE(IDC_HAND_CUR)));
		return TRUE;
	}

	return __super::OnSetCursor(pWnd,nHitTest,uMessage);
}
Example #2
0
void wxMouseEventsManager::OnLeftDown(wxMouseEvent& event)
{
    wxASSERT_MSG( m_state == State_Normal,
                  "state hasn't been reset to normal somehow" );

    m_posLast = event.GetPosition();
    m_item = MouseHitTest(m_posLast);
    if ( m_item == wxNOT_FOUND )
    {
        event.Skip();
        return;
    }

    m_state = State_Pressed;
    m_win->SetFocus();
    m_win->CaptureMouse();
    MouseClickBegin(m_item);
}