CRectTracker::TrackRubberBand

Call this function to do rubber-band selection.

BOOL TrackRubberBand(
   CWnd* pWnd,
   CPoint point,
   BOOL bAllowInvert = TRUE 
);

Parameters

  • pWnd
    The window object that contains the rectangle.

  • point
    Device coordinates of the current mouse position relative to the client area.

  • bAllowInvert
    If TRUE, the rectangle can be inverted along the x-axis or y-axis; otherwise FALSE.

Return Value

Nonzero if the mouse has moved and the rectangle is not empty; otherwise 0.

Remarks

It is usually called from inside the function of your application that handles the WM_LBUTTONDOWN message (typically OnLButtonDown).

This function will capture the mouse until the user releases the left mouse button, presses the ESC key, or presses the right mouse button. As the user moves the mouse cursor, the feedback is updated by calling DrawTrackerRect and OnChangedRect.

Tracking is performed with a rubber-band-type selection from the lower-right handle. If inverting is allowed, the rectangle can be sized by dragging either up and to the left or down and to the right.

Requirements

Header: afxext.h

See Also

Reference

CRectTracker Class

Hierarchy Chart

CRectTracker::DrawTrackerRect

CRectTracker::OnChangedRect

CRectTracker::CRectTracker

Other Resources

CRectTracker Members