In this example, when the SelectionRectDrawn event fires, its parameters are evaluated. A state variable is then set to True or False to indicate whether a selection rectangle has been drawn by the user.
void CImgEdit1Dlg::OnSelectionRectDrawn(long Left, long Top, long Width, long Height)
{
// If the parameters returned by this event are all 0, the user
// has clicked on the image and removed a previously drawn rectangle
// If parameters have values, a rectangle has been drawn
// IsRectangle would need to be set to false if another image
// is opened/created or another page is displayed.
// This technique could also be used for enabling disable cut copy
// paste menu picks.
if (Width + Height == 0)
blnIsRectangle = FALSE;
else
blnIsRectangle = TRUE;
}