Énumération ContextLinkDirection

Spécifie la direction d’un objet IContextLink .

Syntaxe

typedef enum ContextLinkDirection { 
  ContextLinkDirection_LinksWith  = 0,
  ContextLinkDirection_LinksFrom  = 1,
  ContextLinkDirection_LinksTo    = 2
} ContextLinkDirection;

Constantes

ContextLinkDirection _ LinksWith

Le IContextNode est un dessin directionnel qui pointe vers l’extérieur du IContextLink.

ContextLinkDirection _ LinksFrom

Le IContextNode est un dessin directionnel qui pointe vers le IContextLink.

ContextLinkDirection _ LinksTo

Il n’existe aucun dessin directionnel dans le lien. Par exemple, un dessin manuscrit peut souligner un mot manuscrit. Aucune direction n’est déduite du soulignement.

Exemples

L’exemple suivant prend un objet IContextNode , m_pSelectedNode , et enregistre tous les objets IContextNode auxquels il est lié en parcourant l’arborescence ancêtre et en ajoutant les objets dans un CArray objet linkedToNodes . CheckHResult est une fonction qui accepte un HRESULT et une chaîne, et lève une exception créée avec la chaîne si le HRESULT n’a pas réussi.

// Find all first ancestor that contains links of type Enclose
CArray<IContextNode*,IContextNode*> linkedToNodes = CArray<IContextNode*,IContextNode*>();
IContextNode* pAncestor;
CheckHResult(m_pSelectedNode->GetParentNode(&pAncestor),
    "IContextNode::GetParentNode failed");
while (pAncestor != NULL)
{
    // Get the links
    IContextLinks* pLinks;
    CheckHResult(pAncestor->GetContextLinks(&pLinks),
        "IContextNode::GetContextLinks failed");
    ULONG nLinks;
    CheckHResult(pLinks->GetCount(&nLinks), "IContextLinks::GetCount failed");
    for (ULONG i = 0; i < nLinks; i++)
    {
        IContextLink* pLink;
        CheckHResult(pLinks->GetContextLink(i, &pLink),
            "IContextLinks::GetContextLink failed");
        // Check link direction
        ContextLinkDirection linkDirection;
        CheckHResult(pLink->GetContextLinkDirection(&linkDirection),
            "IContextLink:GetContextLinkDirection failed");
        if (linkDirection == ContextLinkDirection_LinksTo)
        {
            // Get source node and add the array
            IContextNode* pSourceNode;
            CheckHResult(pLink->GetSourceNode(&pSourceNode),
                "IContextLink::GetSourceNode failed");
            linkedToNodes.Add(pSourceNode);
        }
    }
            
    // Go up another level
    IContextNode* pNewAncestor;
    CheckHResult(pAncestor->GetParentNode(&pNewAncestor),
        "IContextNode::GetParentNode failed");
    pAncestor = pNewAncestor;
}

Spécifications

Condition requise Valeur
Client minimal pris en charge
Windows Applications de bureau XP Édition Tablet PC [ uniquement]
Serveur minimal pris en charge
Aucun pris en charge
En-tête
IACom. h (nécessite également IACom _ i. c)

Voir aussi

IContextLink

IContextNode::AddContextLink