请详细解释一下DrawDragRect这个API函数

解决方案 »

  1.   

    CDC::DrawDragRect
    void DrawDragRect( LPCRECT lpRect, SIZE size, LPCRECT lpRectLast, SIZE sizeLast, CBrush* pBrush = NULL, CBrush* pBrushLast = NULL );ParameterslpRectPoints to a RECT structure or a CRect object that specifies the logical coordinates of a rectangle — in this case, the end position of the rectangle being redrawn.指向RECT结构或Crect对象的指针。它包含指定矩形的逻辑坐标——在此情况下,矩形的端点位置将被重新绘制。 sizeSpecifies the displacement from the top-left corner of the outer border to the top-left corner of the inner border (that is, the thickness of the border) of a rectangle.指定矩形外边界的左上角与内边界的左上角的偏移量(即边界的厚度)。 lpRectLastPoints to a RECT structure or a CRect object that specifies the logical coordinates of the position of a rectangle — in this case, the original position of the rectangle being redrawn.指向RECT结构或Crect对象的指针。它包含指定矩形的逻辑坐标棗在此情况下,矩形的原始位置处于重新绘制状态。 sizeLastSpecifies the displacement from the top-left corner of the outer border to the top-left corner of the inner border (that is, the thickness of the border) of the original rectangle being redrawn.指定重新绘制的矩形的外边界的左上角与内边界的左上角的偏移量(即边界的厚度)。 pBrushPointer to a brush object. Set to NULL to use the default halftone brush.指向画刷的指针。设置为NULL时,使用缺省的黑白画刷。 pBrushLastPointer to the last brush object used. Set to NULL to use the default halftone brush.指向最近使用的画刷指针。 ResCall this member function repeatedly to redraw a drag rectangle. Call it in a loop as you sample mouse position, in order to give visual feedback. When you call DrawDragRect, the previous rectangle is erased and a new one is drawn. For example, as the user drags a rectangle across the screen, DrawDragRect will erase the original rectangle and redraw a new one in its new position. By default, DrawDragRect draws the rectangle by using a halftone brush to eliminate flicker and to create the appearance of a smoothly moving rectangle. 反复调用该成员函数以重新绘制一个拖动的矩形。为得到视觉反馈,可以在指定鼠标位置后循环调用该函数。当调用DrawDragRect 后,前一个矩形被抹去而重新绘制一个新矩形。例如,当用户在屏幕上拖动矩形时,DrawDragRect 将抹去先前的一个,而在新位置上重新绘制。缺省地,DrawDragRect 用黑白画刷绘制矩形,创建一个平滑移动的矩形。 The first time you call DrawDragRect, the lpRectLast parameter should be NULL. 当第一次调用DrawDragRect 时,lpRectLast参数应设置为NULL。