如何使鼠标中键单击滚动功能? [英] How to make function for middle mouse button click scrolling ?

查看:120
本文介绍了如何使鼠标中键单击滚动功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!...经验丰富...我是MFC的新手,我在应用程序中完成了普通的鼠标滚轮操作,但现在我想为我的应用程序单击鼠标滚动".我有两个视图,我想同时滚动两个视图但是它不能仅在单个页面中滚动,而是在两个页面中都可以正常滚动.我为此使用了此功能(请参见下文).您能帮我些忙吗?

Hi !...experienced...i am new with MFC and i have done normal mouse wheel in my application but now i want to mouse Click Scrolling for my application.i have two view and i want simultaniousaly scrolling in both but it not scrolling in both only in single but normal scrolling is done in both.i am using this function(see below)for it..may you help me something ?

void CsdView::OnMButtonDown(UINT nFlags, CPoint point) 
{
	CPoint ptScroll = GetScrollPosition();
	CsdMainFrm* pMainFrm = ( CsdMainFrm* )::AfxGetMainWnd();
    VERIFY( pMainFrm );
    CsdChildFrame* pChildFrm = ( CsdChildFrame* ) pMainFrm->MDIGetActive();
    VERIFY( pChildFrm );
	 if( c_bScrollingInitiator )
    {
        c_bScrollingInitiator = FALSE;
    }
    else
    {
        c_bScrollingInitiator = TRUE;
        pChildFrm->SetScrollView( ptScroll, c_nPane );
    }
	  InvalidateRect( &c_rectHeadingMostRecent );
	
    CWindowScroller *ws = new CWindowScroller (this, point);
}

推荐答案

使用nFlags变量非常容易.这是示例代码:

It is very easy using nFlags variable. Here is the sample code:

BOOL CClickScrollingDlg::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)<br />
{<br />
	if(nFlags == MK_MBUTTON)<br />
	{<br />
		if(zDelta>0)<br />
			MessageBox(L"UP!!!");<br />
		else if(zDelta<0)<br />
			MessageBox(L"DOWN!!!");<br />
	}<br />
<br />
	return CDialog::OnMouseWheel(nFlags, zDelta, pt);<br />
}


这篇关于如何使鼠标中键单击滚动功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆