如何重绘CLISTCTRL控件的滚动条
1个回答
展开全部
在vc++中为窗口增加滚动条的方法:
Add a message handler for the WM_VSCROLL message to the OnVScroll method:
void CTestDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default.
int nDelta;
int nMaxPos = m_rect.Height() - m_nCurHeight;
switch (nSBCode)
{
case SB_LINEDOWN:
if (m_nScrollPos >= nMaxPos)
return;
nDelta = min(nMaxPos/100,nMaxPos-m_nScrollPos);
break;
case SB_LINEUP:
if (m_nScrollPos <= 0)
return;
nDelta = -min(nMaxPos/100,m_nScrollPos);
break;
case SB_PAGEDOWN:
if (m_nScrollPos >= nMaxPos)
return;
nDelta = min(nMaxPos/10,nMaxPos-m_nScrollPos);
break;
Add a message handler for the WM_VSCROLL message to the OnVScroll method:
void CTestDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default.
int nDelta;
int nMaxPos = m_rect.Height() - m_nCurHeight;
switch (nSBCode)
{
case SB_LINEDOWN:
if (m_nScrollPos >= nMaxPos)
return;
nDelta = min(nMaxPos/100,nMaxPos-m_nScrollPos);
break;
case SB_LINEUP:
if (m_nScrollPos <= 0)
return;
nDelta = -min(nMaxPos/100,m_nScrollPos);
break;
case SB_PAGEDOWN:
if (m_nScrollPos >= nMaxPos)
return;
nDelta = min(nMaxPos/10,nMaxPos-m_nScrollPos);
break;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询