Home > Software engineering >  After the CtreeCtrl hide the scroll bar, how to implement the mouse wheel rolling function
After the CtreeCtrl hide the scroll bar, how to implement the mouse wheel rolling function

Time:09-24

Excuse me, CtreeCtrl controls, hide the scroll bar, how to realize the mouse wheel rolling function, many thanks!


One, to Scroll controls attribute is set to False, what all can't mobile controls node

Second, the control property Scroll is set to True, the function m_tree. EnableScrollBarCtrl (1, FALSE);//hidden scrollbar
Can be hidden by the scroll bar, but the mouse in the control area, rolling wheel, unable to trigger the dialog onm ouseWheel message,

CodePudding user response:

"The mouse on the control area"?

CodePudding user response:

SPY++ see if any WM_MOUSEWHEEL message?
Is there a focus to control?

CodePudding user response:

May be a custom painting

CodePudding user response:

refer to the second floor zgl7903 response:
SPY++ see if any WM_MOUSEWHEEL message?
Is there a focus to control?



Have get focus (node text color),

This control wheel rotation, SPY++ monitor prompt "WM_KICKIDLE
"

CodePudding user response:

BOOL cTree: : onm ouseWheel (UINT nFlags, short zDelta, CPoint pt)
{
//TODO: Add your message handler code here and/or call the default

CRect rcClient;
GetClientRect (rcClient);
Int hei=GetItemHeight ();
Hei/=zDelta/WHEEL_DELTA;
CRect scrollRect (0, hei, rcClient. Right, rcClient, bottom);
ScrollWindowEx ( 0, hei, & amp; ScrollRect, & amp; ScrollRect, 0, 0, SW_INVALIDATE);
Return TRUE;
} you will also need to redraw the line

CodePudding user response:

CTreeCtrl: : SelectSetFirstVisible

CodePudding user response:

BOOL cTree: : onm ouseWheel (UINT nFlags, short zDelta, CPoint pt)
{
//TODO: Add your message handler code here and/or call the default
HTREEITEM hItem=GetFirstVisibleItem ();
If (zDelta & gt; 0)
HItem=GetPrevVisibleItem (hItem);
The else
HItem=GetNextVisibleItem (hItem);
SelectSetFirstVisible (hItem);
Return TRUE;

CodePudding user response:

Thank you schlafenhamster patience guidance,

I do not practice MFC, in a small tool, practice while learning, the content of the reply didn't see,

6th floor mean overloading CTreeCtrl class, a new class named cTree, rewrite onm ouseWheel function in the new class?



CodePudding user response:

The very!!!!!!!!!!

CodePudding user response:

Well don't have to scroll bar, not at odds?

CodePudding user response:

Their processing roller, WM_VSCROLL message sent to the tree,
  • Related