AnnotationBackColor Example VC++

This example adds an annotation group, sets the annotation type, sets the background color of the annotation, and then draws the mark. (Annotation groups are not actually created until a mark is drawn in the group.)

void CFrmGroup::OnAddGroup() 
{
    // Adds a group and draws a mark in the group. Annotation groups
    // are not actually created until a mark is drawn in the group.

    CString szCurGroup;

    szCurGroup.Format("Accounting Dept %i",rand());
    // Get the name of the group the user clicked on in the listbox
    m_GroupList.AddString(szCurGroup);
    if(pParentDlg)
    {
      pParentDlg->ImgEdit1.AddAnnotationGroup(szCurGroup);
      pParentDlg->ImgEdit1.SetAnnotationType(10);  // wiTextAttachment  // 10
      pParentDlg->ImgEdit1.SetAnnotationBackColor(0xFFFF); // vbYellow
      VARIANT vWidth; V_VT(&vWidth) = VT_I2; V_I2(&vWidth) = 150;
      VARIANT vHeight; V_VT(&vHeight) = VT_I2; V_I2(&vHeight) = 100;
      pParentDlg->ImgEdit1.Draw(10, 10, vWidth, vHeight);
    }
    
    // The user must manually enter the text on the attachment
}