AnnotationGroupCount Example VC++

This example uses the AnnotationGroupCount property to determine the number of groups on an image.  Then it uses the GetAnnotationGroup method to get the group names.

BOOL CFrmGroup::OnInitDialog() 
{
    CDialog::OnInitDialog();

    // This routine uses AnnotationGroupCount to determine
    // the number of groups on an image and then gets the
    // group names using the GetAnnotationGroup method.
    
    int iNumGroups;
    CString szGroupName;
    int iCount;
    
    // find out how many groups are on the page
    iNumGroups = pParentDlg->ImgEdit1.GetAnnotationGroupCount();
    
    // Since index values of GetAnnotationGroup start with
    // 0 have to loop one less than the number of groups
    for (iCount = 0;iCount < iNumGroups ; iCount++)
    {
        szGroupName = pParentDlg->ImgEdit1.GetAnnotationGroup(iCount);
        // write names of groups to a listbox
        m_GroupList.AddString (szGroupName);
    }

    return TRUE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX Property Pages should return FALSE
}