ICoNtextNode 介面

表示物件樹狀結構中的節點,這些物件會建立為筆跡分析的一部分。

成員

ICoNtextNode介面繼承自IUnknown介面。 ICoNtextNode 也有下列類型的成員:

方法

ICoNtextNode介面具有這些方法。

方法 Description
AddCoNtextLink 將新的ICoNtextLink 新增至 ICoNtextNode物件的內容連結集合。
AddPropertyData 新增一段應用程式特定資料。
確認 修改確認類型,控制 IInkAnalyzer 物件可以變更 ICoNtextNode的內容。
ContainsPropertyData 判斷 ICoNtextNode 物件是否包含儲存在指定識別碼下的資料。
CreatePartiallyPopulatedSubNode 建立只包含類型、識別碼和位置資訊的子 ICoNtextNode 物件。
CreateSubNode 建立新的子 ICoNtextNode 物件。
DeleteCoNtextLink ICoNtextNode 物件的連結集合中刪除 ICoNtextLink 物件。
DeleteSubNode 移除子 ICoNtextNode
GetCoNtextLinks 擷取 ICoNtextLink 物件的集合,代表與其他 ICoNtextNode 物件的關聯性。
GetId 擷取 ICoNtextNode 物件的識別碼。
GetLocation 擷取 ICoNtextNode 物件的位置和大小。
GetParentNode 擷取內容節點樹狀結構中這個 ICoNtextNode 的父節點。
GetPartiallyPopulated 擷取值,指出 ICoNtextNode 物件是否已部分填入或完全填入。
GetPropertyData 擷取指定識別碼的應用程式特定資料或其他屬性資料。
GetPropertyDataIds 擷取有屬性資料的識別碼。
GetStrokeCount 擷取與 ICoNtextNode 物件相關聯的筆劃數目。
GetStrokeId 擷取 ICoNtextNode 物件內索引值所參考之筆劃的筆劃識別碼。
GetStrokeIds 擷取 ICoNtextNode 物件內筆劃的識別碼陣列。
GetStrokePacketDataById 擷取陣列,其中包含指定筆劃的封包屬性資料。
GetStrokePacketDescriptionById 擷取陣列,其中包含指定筆劃的封包屬性識別碼。
GetSubNodes 擷取 ICoNtextNode 物件的直接子節點。
GetType 擷取 ICoNtextNode 物件的類型。
GetTypeName 擷取這個 ICoNtextNode的人類可讀取類型名稱。
IsConfirmed 擷取值,指出是否已確認 ICoNtextNode 物件。 IInkAnalyzer 無法變更已確認 ICoNtextNode 物件的節點類型和相關聯的筆劃。
LoadPropertiesData 針對先前使用 ICoNtextNode::SavePropertiesData建立的位元組陣列,重新建立應用程式特定和內部屬性資料。
MoveSubNodeToPosition 將指定的子 ICoNtextNode 物件重新排列為指定的索引。
RemovePropertyData 移除應用程式特定資料的片段。
重新父系 將此 ICoNtextNode 物件從其父內容節點的子節點集合移至指定的內容節點子節點集合。
ReparentStrokeByIdToNode 將筆劃資料從這個 ICoNtextNode 移至指定的 ICoNtextNode
SavePropertiesData 擷取位元組陣列,其中包含這個 ICoNtextNode的應用程式特定和內部屬性資料。
SetLocation 更新這個ICoNtextNode的位置和大小。
SetPartiallyPopulated 修改值,指出這個 ICoNtextNode 是否部分填入或完全填入。
SetStrokes 將指定的筆劃與這個 ICoNtextNode產生關聯。

備註

節點的類型會在 內容節點類型 常數中描述。

範例

下列範例顯示檢查 ICoNtextNode的方法;方法會執行下列動作:

  • 取得內容節點的類型。 如果內容節點是未分類的筆跡、分析提示或自訂辨識器節點,它會呼叫協助程式方法來檢查節點類型的特定屬性。
  • 如果節點有子節點,它會藉由呼叫本身來檢查每個子節點。
  • 如果節點是筆跡分葉節點,它會呼叫協助程式方法來檢查節點的筆劃資料。

Ihe InkAnalysis API 可讓您建立包含筆跡字和文字字組的線條節點。 不過,剖析器會忽略這些混合節點,並將它們視為外部節點。 這會影響使用者在此混合節點上寫入或繞著這個混合節點寫入時偵測筆跡批註的剖析精確度。

HRESULT CMyClass::ExploreContextNode(
    IContextNode *pContextNode)
{
    // Check for certain types of context nodes.
    GUID ContextNodeType;
    HRESULT hr = pContextNode->GetType(&ContextNodeType);

    if (SUCCEEDED(hr))
    {
        if (IsEqualGUID(GUID_CNT_UNCLASSIFIEDINK, ContextNodeType))
        {
            // Call a helper method that explores unclassified ink nodes.
            hr = this->ExploreUnclassifiedInkNode(pContextNode);
        }
        else if (IsEqualGUID(GUID_CNT_ANALYSISHINT, ContextNodeType))
        {
            // Call a helper method that explores analysis hint nodes.
            hr = this->ExploreAnalysisHintNode(pContextNode);
        }
        else if (IsEqualGUID(GUID_CNT_CUSTOMRECOGNIZER, ContextNodeType))
        {
            // Call a helper method that explores custom recognizer nodes.
            hr = this->ExploreCustomRecognizerNode(pContextNode);
        }

        if (SUCCEEDED(hr))
        {
            // Check if this node is a branch or a leaf node.
            IContextNodes *pSubNodes = NULL;
            hr = pContextNode->GetSubNodes(&pSubNodes);

            if (SUCCEEDED(hr))
            {
                ULONG ulSubNodeCount;
                hr = pSubNodes->GetCount(&ulSubNodeCount);

                if (SUCCEEDED(hr))
                {
                    if (ulSubNodeCount > 0)
                    {
                        // This node has child nodes; explore each child node.
                        IContextNode *pSubNode = NULL;
                        for (ULONG index=0; index<ulSubNodeCount; index++)
                        {
                            hr = pSubNodes->GetContextNode(index, &pSubNode);

                            if (SUCCEEDED(hr))
                            {
                                // Recursive call to explore the child node of this
                                // context node.
                                hr = this->ExploreContextNode(pSubNode);
                            }

                            // Release this reference to the child context node.
                            if (pSubNode != NULL)
                            {
                                pSubNode->Release();
                                pSubNode = NULL;
                            }

                            if (FAILED(hr))
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        // This is a leaf node. Check if it contains stroke data.
                        ULONG ulStrokeCount;
                        hr = pContextNode->GetStrokeCount(&ulStrokeCount);

                        if (SUCCEEDED(hr))
                        {
                            if (ulStrokeCount > 0)
                            {
                                // This node is an ink leaf node; call helper
                                // method that explores available stroke data.
                                hr = this->ExploreNodeStrokeData(pContextNode);
                            }
                        }
                    }
                }
            }

            // Release this reference to the subnodes collection.
            if (pSubNodes != NULL)
            {
                pSubNodes->Release();
                pSubNodes = NULL;
            }
        }
    }

    return hr;
}

規格需求

需求
最低支援的用戶端
Windows XP Tablet PC Edition [僅限傳統型應用程式]
最低支援的伺服器
都不支援
標頭
IACom.h (也需要 IACom_i.c)
DLL
IACom.dll

另請參閱

ICoNtextNodes

內容節點類型

IInkAnalyzer

筆跡分析參考