MFC 继承CListBox 在重载OnVScroll的时候发现拖动关东条的时候鼠标没有放开的时候可以正常拖动,当鼠标放开了以后会自动回到原点,请问这个问题怎么解决,谢谢了代码如下:
void CWMCheckListBox::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
SetTopIndex(nPos);
}
void CWMCheckListBox::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
SetTopIndex(nPos);
}
void CWMCheckListBox::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
int TopIndex = GetTopIndex();
int nCount = GetCount();
CString str;
str.Format(L"%d\n",TopIndex);
TRACE(str);
TRACE(L"nPos %d\n", nPos);
::SendMessage( GetParent()->GetDlgItem( IDC_CUSTOM_COLORLIST )->GetSafeHwnd(), WM_CHECKLIST_VSCROLL, (WPARAM)TopIndex, (LPARAM)nCount ); Invalidate(TRUE);
CCheckListBox::OnVScroll(nSBCode, nPos, pScrollBar); }
void CWMCheckListBox::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
int TopIndex = GetTopIndex();
int nCount = GetCount();
CString str;
str.Format(L"%d\n",TopIndex);
TRACE(str);
TRACE(L"nPos %d\n", nPos);
::SendMessage( GetParent()->GetDlgItem( IDC_CUSTOM_COLORLIST )->GetSafeHwnd(), WM_CHECKLIST_VSCROLL, (WPARAM)TopIndex, (LPARAM)nCount ); Invalidate(TRUE);
CCheckListBox::OnVScroll(nSBCode, nPos, pScrollBar); }