fix:-
To fix this bug in the MFC List Control you need to specialize the control, over-ride the method wich responds to the scroll, and force it to redraw the list completely after it has done the scroll.
SmoothListCtrl.cpp
// SmoothListCtrl.cpp : implementation file
//
#include "stdafx.h"
#include "MFC_Sample.h" // your project header
#include "SmoothListCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSmoothListCtrl
CSmoothListCtrl::CSmoothListCtrl()
{
}
CSmoothListCtrl::~CSmoothListCtrl()
{
}
BEGIN_MESSAGE_MAP(CSmoothListCtrl, CListCtrl)
//{{AFX_MSG_MAP(CSmoothListCtrl)
ON_WM_VSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSmoothListCtrl message handlers
void CSmoothListCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
Invalidate();
UpdateWindow();
}
SmoothListCtrl.h
#if !defined(AFX_SMOOTHLISTCTRL_H__91716634_7EEA_4555_8977_2F7C96751793__INCLUDED_)
#define AFX_SMOOTHLISTCTRL_H__91716634_7EEA_4555_8977_2F7C96751793__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SmoothListCtrl.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CSmoothListCtrl window
class CSmoothListCtrl : public CListCtrl
{
// Construction
public:
CSmoothListCtrl();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSmoothListCtrl)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CSmoothListCtrl();
// Generated message map functions
protected:
//{{AFX_MSG(CSmoothListCtrl)
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SMOOTHLISTCTRL_H__91716634_7EEA_4555_8977_2F7C96751793__INCLUDED_)
No comments:
Post a Comment