MarkSelect Example VC++

In this example, when the MarkSelect event fires, the m_MarkLeft and m_MarkTop variables are assigned the Left and Top coordinates of the selected annotation.

Then, the EditSelectedAnnotationText method in the CImgEdit2Dlg::OnAnnotext() procedure, permits the user to edit the text of the selected annotation.

void CImgEdit2Dlg::OnAnnotext() 
{
    // This would allow the user to edit the text of an existing
    // selected annotation mark
    TRY {
      // Coordinates of the mark are obtained from the MarkSelect
      // event (see code below).
      ImgEdit1.EditSelectedAnnotationText(m_MarkLeft, m_MarkTop);
    }
    CATCH (COleDispatchException, e)
    {
      // Handle error if no mark is selected or the wrong type
      // of mark is selected
       AfxMessageBox(e->m_strDescription);
      //Err.Description
    }
    END_CATCH 
}
void CImgEdit2Dlg::OnMarkSelect(short Button, short Shift, long Left,
 long Top, long Width, long Height, short MarkType, LPCTSTR GroupName) 
{
    m_MarkLeft = Left;
    m_MarkTop = Top;
}