CWindowScroller类,用于鼠标中键滚动 [英] CWindowScroller Class for middle mouse press scrolling

查看:95
本文介绍了CWindowScroller类,用于鼠标中键滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用CWindowScroller这个类用于在两个视图中一起滚动鼠标中键.您可以在这里查看:
http://www.codeproject.com/KB/miscctrl/windowscroller.aspx

滚动是通过将CWindowScroller类的对象放入OnMButtonDown函数来完成的,就像

I used CWindowScroller the class for middle mouse press scrolling together in two views. you can check here :
http://www.codeproject.com/KB/miscctrl/windowscroller.aspx

scrolling is done by making object of CWindowScroller class into OnMButtonDown function,like

void CsdView::OnMButtonDown(UINT nFlags, CPoint point)      
{
    CWindowScroller *ws = new CWindowScroller (this, point);
}



其实我在控件"和测试"这两个视图上都有watemark.但是这些都没有得到刷新.我已经通过使用InvalidateRect()函数进行垂直,水平和鼠标滚轮滚动来完成刷新,但是它无法用于OnMButtonDown函数.鼠标滚轮的示例,可以正常工作,但不能通过鼠标中键滚动.示例:



Actually i have watemark on both view like "Control" and "Test".but these are not getting refresh.I have done refresh by using InvalidateRect() function for vertical,horizantal and mouse wheel scrolling, but it is not working into OnMButtonDown function. The example of Mouse Wheel, that is working fine ,but not middle mouse press scrolling.Example :

BOOL CsdView::OnMouseWheel(UINT fFlags, short zDelta, 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 );
	  
	  // we can''t get out of it--perform the scroll ourselves	
    return DoMouseWheel(fFlags, zDelta, point);
}


有人可以帮助我吗?


any one can help me ?

推荐答案

您好,您需要确保您未在​​CScrollView中处理WM_MBUTTONDOWN消息,因为这会禁用平移图标.
删除
ON_WM_MBUTTONDOWN()
void CScrollerView :: OnMButtonDown(UINT nFlags,CPoint点)

afx_msg void OnMButtonDown(UINT nFlags,CPoint point);

从您的CScrollView类.只要显示滚动条,按下鼠标左键"时就会显示平移"图标.

西亚兰(Ciaran)
Hi, you need to make sure that you are not handling the WM_MBUTTONDOWN message in your CScrollView as this disables the Panning Icon.
Remove
ON_WM_MBUTTONDOWN()
void CScrollerView::OnMButtonDown(UINT nFlags, CPoint point)
and
afx_msg void OnMButtonDown(UINT nFlags, CPoint point);

from your CScrollView class. The Panning Icon will display when you press the Left Mouse button as long as the scroll bars are showing.

Ciaran


这篇关于CWindowScroller类,用于鼠标中键滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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