I created a CListCtrl class, after using CScrollBar m_CScrollBar
to control the scroll barInt CMyListCtrl: : OnCreate (LPCREATESTRUCT LPCREATESTRUCT)// this is CMyListCtrl class inheritance from CListCtrl
{
If (CListCtrl: : OnCreate (lpCreateStruct)==1)
return -1;
//TODO: Add your specialized creation code here
CRect the rect.
GetWindowRect (& amp; The rect);
The ScreenToClient (& amp; The rect);
The rect. Left=the rect. Right - GetSystemMetrics (SM_CXVSCROLL);
M_CScrollBar. Create (WS_CHILD | WS_VISIBLE | SB_VERT, the rect, this, 4051);
M_CScrollBar. EnableScrollBar (ESB_ENABLE_BOTH);
M_CScrollBar. SetScrollRange (0, 1000);
M_CScrollBar. SetScrollPos (500);
return 0;
}
Void CMyListCtrl: : OnVScroll (UINT nSBCode, UINT nPos, CScrollBar * pScrollBar)
{
If (==pScrollBar - 4051 & gt; GetDlgCtrlID ())
{
The switch (nSBCode)
{
Case SB_LINEUP://but it is this response
no newsbreak;
Case SB_LINEDOWN:
break;
Case SB_PAGEUP:
break;
Case SB_PAGEDOWN:
break;
}
}
In a word, I use the mouse to click on the arrow above, there is no SB_LINEUP message
CListCtrl: : OnVScroll (nSBCode, nPos, pScrollBar);
}
CodePudding user response:
CListCtrl own scrollbar why create by yourself?CodePudding user response: