Home > Software engineering >  CScrollBar vertical scroll bar above the arrow is invalid, how to do?
CScrollBar vertical scroll bar above the arrow is invalid, how to do?

Time:11-20



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:

reference 1st floor schlafenhamster response:
CListCtrl own scrollbar why create by yourself?

Own amounted to less than I want, so can create their own

CodePudding user response:

The client area on the right side of the small a sb width

CodePudding user response:

reference schlafenhamster reply: 3/f
client area on the right side of the small a sb width

Can pull a little? I'm in the CListCtrl class created inside

CodePudding user response:

CListCtrl when creating the client area can be smaller (or MoveWindow)
  • Related