Udostępnij za pośrednictwem


CRectTracker::Track

Call this function to display the user interface for resizing the rectangle.

BOOL Track(
   CWnd* pWnd,
   CPoint point,
   BOOL bAllowInvert = FALSE,
   CWnd* pWndClipTo = NULL 
);

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.

  • pWndClipTo
    The window that drawing operations will be clipped to. If NULL, pWnd is used as the clipping rectangle.

Return Value

If the ESC key is pressed, the tracking process is halted, the rectangle stored in the tracker is not altered, and 0 is returned. If the change is committed, by moving the mouse and releasing the left mouse button, the new position and/or size is recorded in the tracker's rectangle and nonzero is returned.

Remarks

This 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.

If bAllowInvert is TRUE, the tracking rectangle can be inverted on either the x-axis or y-axis.

Requirements

Header: afxext.h

See Also

Reference

CRectTracker Class

Hierarchy Chart

CRectTracker::DrawTrackerRect

CRectTracker::OnChangedRect

CRectTracker::CRectTracker

CRectTracker::TrackRubberBand

Other Resources

CRectTracker Members