ContextLinkDirection 枚举

指定 IContextLink 对象的方向。

语法

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

常量

ContextLinkDirection_LinksWith

IContextNode 是指向远离 IContextLink 的方向绘制。

ContextLinkDirection_LinksFrom

IContextNode 是指向 IContextLink 的方向绘图。

ContextLinkDirection_LinksTo

链接中没有方向绘图。 例如,墨迹绘图可以为墨迹字下划线。 没有从下划线推断的方向。

示例

以下示例采用 IContextNode 对象 m_pSelectedNode,并通过向上浏览上级树并将对象添加到 对象 中CArray来保存它链接到的所有 IContextNode 对象linkedToNodesCheckHResult是一个采用 HRESULT 和 字符串的函数,如果 不是 SUCCESS,则HRESULT引发使用该字符串创建的异常。

// 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;
}

要求

要求
最低受支持的客户端
Windows XP Tablet PC Edition [仅限桌面应用]
最低受支持的服务器
无受支持的版本
标头
IACom.h (还需要 IACom_i.c)

另请参阅

IContextLink

IContextNode::AddContextLink