AnnGetGrouping example for C++ 4.0 and later
//This event is fired for each annotation
//Toggles the Grouping feature for all the containers
void CMFC42samplesDlg::OnAnnEnumerateLeadctrl1(long hObject)
{
if(m_Lead1.AnnGetType(hObject) == ANNOBJECT_CONTAINER)
m_Lead1.AnnSetGrouping(hObject, !m_Lead1.AnnGetGrouping(hObject), 0);
}
// Add subcontainers by selecting objects and grouping them
// before clicking on this button
// Note that after you disable the grouping you can select and change
// individual objects belonging to a group. When you re-enable
// the grouping, the objects act as a group again.
void CMFC42samplesDlg::OnButtonAnnenumerate()
{
m_Lead1.SetAnnUserMode(ANNUSERMODE_DESIGN);
m_Lead1.AnnEnumerate(m_Lead1.GetAnnContainer(), ANNFLAG_RECURSE| ANNFLAG_NOTTHIS, NULL);
}