2 Jun 2012 18:28
Minor artefact with CScrollWindowImpl...
Hi Nenad,
I have controls derived from 'CScrollWindowImpl<MyControl, CFSBWindow>' and particularly a DataGrid.
I noticed that when I turned my mouse's wheel (even if I dont need to scroll) some parts of my control were flickering.
So I checked the atlscrl.h file's code, more precisely CScrollImpl and the OnMouseWheel handler (line
#491 for the latest version of WTL) and found this:
if(m_sizeAll.cy > m_sizeClient.cy)
{
for(int i = 0; i < zTotal; i += WHEEL_DELTA)
{
pT->DoScroll(SB_VERT, nScrollCode, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy);
pT->UpdateWindow();
}
}
else // can't scroll vertically, scroll horizontally
{
for(int i = 0; i < zTotal; i += WHEEL_DELTA)
{
pT->DoScroll(SB_HORZ, nScrollCode, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx);
pT->UpdateWindow();
}
}
This code means that if the mouse's wheel is turned then
if(m_sizeAll.cy > m_sizeClient.cy)
it will scroll vertically and update (repaint) the client rect of the control
else
it will scroll horizontally and update (repaint) the client rect of the control
(Continue reading)
RSS Feed