Still no answer? That's really sad. :((
I finally found a solution by myself, it's a little ugly but it work.
My solution is using my own scrolling function instead of the system's, following is detail
1. Overrides CScrollview::OnScrollBy, the core part of scrolling is implemented by this method.
2. Copies the MFC CScrollview::OnScrollBy source code to the overridden function
3. Uses following code instead of the line which has ::ScrollWindowEx
CRect srcRect;
GetClientRect(clientRect);
if( yAmount > 0 ){
srcRect.DeflateRect( 0, 0, 0, yAmount );
} else {
srcRect.DeflateRect( 0, -yAmount, 0, 0 );
}
CDC* dc = GetDCEx( NULL, DCX_CACHE | DCX_WINDOW| DCX_CLIPSIBLINGS );
CRect destRect = srcRect;
destRect.OffsetRect( 0, yAmount );
dc->BitBlt( destRect.left, destRect.top, destRect.Width(), destRect.Height(),
dc, srcRect.left, srcRect.top,
SRCCOPY);
CRect invalidRect;
GetClientRect( &invalidRect );
invalidRect.SubtractRect( invalidRect, dest );
InvalidateRect( &invalidRect, TRUE );
}
{
HWND hWndChild = ::GetWindow(m_hWnd, GW_CHILD);
if (hWndChild != NULL)
{
for (; hWndChild != NULL;
hWndChild = ::GetNextWindow(hWndChild, GW_HWNDNEXT))
{
CRect rect;
::GetWindowRect(hWndChild, &rect);
ScreenToClient(&rect);
::SetWindowPos(hWndChild, NULL,
rect.left+xAmount, rect.top+yAmount, 0, 0,
SWP_NOSIZE|SWP_NOACTIVATE|SWP_NOZORDER);
}
}
}
Note: The above code implements the vertical scrolling only, but it's easy to add horizontal implementation by yourself.
The principal of the code is using a non-clipped DC instead of clipped DC to do scrolling, GetDCEx() is used to get such non-clipped DC. Then the source and destination of bitblt() are calculated, and copies the content from source to destination according to the calculation result. Next calculates the invalid rect of the window and invalidate it, the system will automatically repaint this area later. Finally scrolls all child windows.
I've test it on the emulator and my O2 mobile phone, it works fine so far. I have to say it's not a perfect solution but it's the only way I can find till now.
Please let me know if you have any problem or suggestion with no hesitate.
goldencz(AT)263.net