回 帖 发 新 帖 刷新版面

主题:关于滚屏函数ScrollWindowEx的若干疑问?

ScrollWindowEx函数在msdn中有定义如下:
ScrollWindowEx
The ScrollWindowEx function scrolls the content of the specified window's client area. 

int ScrollWindowEx(
  HWND hWnd,        // handle to window to scroll
  int dx,           // amount of horizontal scrolling
  int dy,           // amount of vertical scrolling
  CONST RECT *prcScroll,
                    // address of structure with scroll rectangle
  CONST RECT *prcClip,
                    // address of structure with clip rectangle
  HRGN hrgnUpdate,  // handle to update region
  LPRECT prcUpdate, // address of structure for update rectangle
  UINT flags        // scrolling flags
);
 
Parameters
hWnd 
Handle to the window where the client area is to be scrolled. 
dx 
Specifies the amount, in device units, of horizontal scrolling. This parameter must be a negative value to scroll to the left. 
dy 
Specifies the amount, in device units, of vertical scrolling. This parameter must be a negative value to scroll up. 
prcScroll 
Pointer to theRECT structure specifying the portion of the client area to be scrolled. If this parameter is NULL, the entire client area is scrolled. 
prcClip 
Pointer to the RECT structure containing the coordinates of the clipping rectangle. Only device bits within the clipping rectangle are affected. Bits scrolled from the outside of the rectangle to the inside are painted; bits scrolled from the inside of the rectangle to the outside are not painted. 
hrgnUpdate 
Handle to the region that is modified to hold the region invalidated by scrolling. This parameter may be NULL. 
prcUpdate 
Pointer to the RECT structure receiving the boundaries of the rectangle invalidated by scrolling. This parameter may be NULL. 
flags 
Specifies flags that control scrolling. This parameter can be one of the following values: Value Meaning 
SW_ERASE Erases the newly invalidated region by sending a WM_ERASEBKGND message to the window when specified with the SW_INVALIDATE flag. 
SW_INVALIDATE Invalidates the region identified by the hrgnUpdate parameter after scrolling. 
SW_SCROLLCHILDREN Scrolls all child windows that intersect the rectangle pointed to by the prcScroll parameter. The child windows are scrolled by the number of pixels specified by the dx and dy parameters. The system sends a WM_MOVE message to all child windows that intersect the prcScroll rectangle, even if they do not move. 
SW_SMOOTHSCROLL Windows NT 5.0 and later: Scrolls using smooth scrolling. Use the HIWORD portion of the flags parameter to indicate how much time the smooth-scrolling operation should take. 


Return Values
If the function succeeds, the return value is SIMPLEREGION (rectangular invalidated region), COMPLEXREGION (nonrectangular invalidated region; overlapping rectangles), or NULLREGION (no invalidated region). 

If the function fails, the return value is ERROR. To get extended error information, callGetLastError.

Remarks
If the SW_INVALIDATE and SW_ERASE flags are not specified, ScrollWindowEx does not invalidate the area that is scrolled from. If either of these flags is set, ScrollWindowEx invalidates this area. The area is not updated until the application calls theUpdateWindow function, calls theRedrawWindow function (specifying the RDW_UPDATENOW or RDW_ERASENOW flag), or retrieves the WM_PAINT message from the application queue. 

If the window has the WS_CLIPCHILDREN style, the returned areas specified by hrgnUpdate and prcUpdate represent the total area of the scrolled window that must be updated, including any areas in child windows that need updating. 

If the SW_SCROLLCHILDREN flag is specified, the system does not properly update the screen if part of a child window is scrolled. The part of the scrolled child window that lies outside the source rectangle is not erased and is not properly redrawn in its new destination. To move child windows that do not lie completely within the rectangle specified by prcScroll, use the DeferWindowPos function. The cursor is repositioned if the SW_SCROLLCHILDREN flag is set and the caret rectangle intersects the scroll rectangle. 

All input and output coordinates (for prcScroll, prcClip, prcUpdate, and hrgnUpdate) are determined as client coordinates, regardless of whether the window has the CS_OWNDC or CS_CLASSDC class style. Use the LPtoDP and DPtoLP functions to convert to and from logical coordinates, if necessary. 

Windows CE: The flags parameter does not support SW_SCROLLCHILDREN. 

Only one of the dx and dy parameters can be nonzero. 

也许在这个定义中已经说得很明白了,可是我任有很多不明白的地方,希望各位高手不吝赐教。
1、CONST RECT *prcClip这一参数。这个参数究竟是干什么用的?它只是说是剪切矩形区域结构体的指针,究竟作用是干什么的,难道滚屏时还需要剪切什么东西吗?后面关于这一参数的描述我就更不明白了,说是仅仅在剪切区域中的设备位才是受影响的,究竟受什么影响?还有后面那句,由矩形区域外面的滚到里面的才需要被画出,又里面滚到外面的不需要被画出,我觉得这好像是在描述滚屏区域中的情况吧,难道剪切区域和滚屏区域是一回事吗?
2、hrgnUpdate 这一参数。它说是为了保持由于滚屏而造成的无效区域而修改的区域的句柄,那么这个被修改的区域究竟是什么区域啊,究竟滚屏函数涉及多少矩形区域啊,请高手能详细告诉我这个菜鸟。
新手在此谢谢你们了。谢谢,谢谢。

回复列表 (共2个回复)

沙发

同问,对这个函数看得是一知半解。

板凳

寻找一直寻找机会的人!
一个趋势中的趋势的项目!
一个直销和传销终结者的项目!
一个帮助普通创业者成功的项目!
   我们在互联网上正在拓展一个生意项目,现在正在寻求合作伙伴。我们认为成功的关键是你是什么人?还有你和谁在一起。我们在乎的是--您是否是有激情、有梦想的人。有意者请跟我们联系,我们和您谈谈,给您讲解一些生意概念,或许我们可以合作。一个集即时网游、交友,娱乐游戏,网络品牌代理商城,互联网平台项目招商进行中……详情QQ空间资料
网商咨询 摩客天宇QQ 909065437 

我来回复

您尚未登录,请登录后再回复。点此登录或注册