ContextNode.PartiallyPopulated 屬性
取得或設定值,這個值表示 ContextNode 物件為部分填入或完整填入。
命名空間: Microsoft.Ink
組件: Microsoft.Ink.Analysis (在 Microsoft.Ink.Analysis.dll 中)
語法
'宣告
Public Property PartiallyPopulated As Boolean
'用途
Dim instance As ContextNode
Dim value As Boolean
value = instance.PartiallyPopulated
instance.PartiallyPopulated = value
public bool PartiallyPopulated { get; set; }
public:
property bool PartiallyPopulated {
bool get ();
void set (bool value);
}
/** @property */
public boolean get_PartiallyPopulated()
/** @property */
public void set_PartiallyPopulated(boolean value)
public function get PartiallyPopulated () : boolean
public function set PartiallyPopulated (value : boolean)
屬性值
型別:System.Boolean
如果 ContextNode 物件在資料 Proxy 程序期間未包含完整的資料,則為 true,如果已加入全部資料,則為 false。
備註
在內容節點樹狀目錄中建立 ContextNode 物件時,您可以在提供所有資訊之前,使用這個屬性做為資料 Proxy。這個屬性表示是否已填入所有資料。
將這個值設定為 true 時,如果 ContextNode 不是 RootNode、CustomRecognizer、AnalysisHint 或未知的 ContextNode,則它必須有非空白的 Location 值。
如果筆劃已刪除且在筆劃快取中找不到筆劃,同時部分樹狀目錄標記為 PartiallyPopulated,則不會透過事件通知應用程式應該從 InkAnalyzer 中移除該筆劃。應用程式會負責移除筆劃。
虛擬化文件樹狀目錄時,請務必在所有 ContextNode 物件上設定 PropertyGuidsForContextNodes.RotatedBoundingBox 值 (使用 ContextNode.AddPropertyValue)。RotatedBoundingBox 屬性是透過 InkAnalyzer 計算,而且根據預設應在所有書寫 ContextNodes 上。不過,如果您的應用程式透過設定 PartiallyPopulated 屬性虛擬化分析結果,請務必在處理 PopulateContextNode 事件時填入 RotatedBoundingBox 屬性。不設定 RotatedBoundingBox 屬性將可能導致在目前分析作業中使用更多文件資料。
範例
下列範例是一個稱為 PopulateNode 的方法 (來自範例程式碼),它會使用 System.Windows.Forms.TreeView (英文) 做為文件模型,示範如何使用資料 Proxy 來儲存和載入 InkAnalyzer 的內容節點樹狀目錄。DocumentNodeData 類別會在每個 TreeNode (英文) 物件的 Tag (英文) 屬性設定為 DocumentNodeData 物件時,儲存文件模型中的 ContextNode 資料。
PopulateNode 方法會使用 ContextNode 物件和 InkAnalyzer 物件,透過加入筆劃、屬性資料、註釋型別、子節點和連結來完整填入內容節點。資料來自 DocumentNodeData 物件,而該物件是從對應的 TreeNode (英文) 取得。
this[analyzerNode.Id] 是文件模型類別上的索引子,會將 Guid (英文) 對應至 TreeNode (英文)。
AddLinksToAnalyer 是文件模型類別上的方法,會將連結加入至 ContextNode。
完整填入節點之後,PartiallyPopulated 屬性會設定為 false。
Sub PopulateNode(ByVal analyzerNode As Microsoft.Ink.ContextNode, _
ByVal theInkAnalyzer As Microsoft.Ink.InkAnalyzer) _
Implements IDocumentModel.PopulateNode
System.Diagnostics.Debug.WriteLine( _
String.Format("IDocumentModel.PopulateNode: populate {0} {1}.", _
TreeViewDocumentModel.GetContextNodeTypeName(analyzerNode.Type), analyzerNode.Id))
System.Diagnostics.Debug.Indent()
' Get the document node associated with the analyzer node.
Dim documentNode As TreeNode = Me(analyzerNode.Id)
If documentNode Is Nothing Then
Throw New ApplicationException("The requested node does not exist in the document model.")
End If
' Get the data associated with the node.
Dim nodeData As DocumentNodeData = documentNode.Tag '
' Copy any application specific data associated with the node to the
' partially populated ContextNode.
Dim identifier As Guid
For Each identifier In nodeData.GetPropertyDataIds()
analyzerNode.AddPropertyData(identifier, nodeData.GetPropertyData(identifier))
Next identifier
' Check if the partially populated ContextNode is an ink leaf node.
If nodeData.IsInkLeafNode Then
' Add the strokes to the context node.
analyzerNode.SetStrokes(nodeData.Strokes)
Else
' Add each child subnode as a partially populated ContextNode.
Dim documentSubNode As TreeNode
For Each documentSubNode In documentNode.Nodes
' Get the DocumentNode data for the
Dim subNodeData As DocumentNodeData = documentSubNode.Tag
If analyzerNode.SubNodes.IndexOf(nodeData.Id) <> -1 Then
analyzerNode.CreatePartiallyPopulatedSubNode( _
subNodeData.Type, subNodeData.Id, subNodeData.Location)
End If
Next documentSubNode
End If
' Add links to the ContextNode.
Me.AddLinksToAnalyzer(documentNode, analyzerNode, theInkAnalyzer)
' Update the partially populated flag.
analyzerNode.PartiallyPopulated = False
System.Diagnostics.Debug.Unindent()
End Sub 'IDocumentModel.PopulateNode
void IDocumentModel.PopulateNode(
Microsoft.Ink.ContextNode analyzerNode,
Microsoft.Ink.InkAnalyzer theInkAnalyzer)
{
System.Diagnostics.Debug.WriteLine(string.Format(
"IDocumentModel.PopulateNode: populate {0} {1}.",
TreeViewDocumentModel.GetContextNodeTypeName(analyzerNode.Type),
analyzerNode.Id));
System.Diagnostics.Debug.Indent();
// Get the document node associated with the analyzer node.
TreeNode documentNode = this[analyzerNode.Id];
if (null == documentNode)
{
throw new ApplicationException(
"The requested node does not exist in the document model.");
}
// Get the data associated with the node.
DocumentNodeData nodeData = documentNode.Tag as DocumentNodeData;
// Copy any application specific data associated with the node to the
// partially populated ContextNode.
foreach (Guid identifier in nodeData.GetPropertyDataIds())
{
analyzerNode.AddPropertyData(
identifier, nodeData.GetPropertyData(identifier));
}
// Check if the partially populated ContextNode is an ink leaf node.
if (nodeData.IsInkLeafNode)
{
// Add the strokes to the context node.
analyzerNode.SetStrokes(nodeData.Strokes);
}
else
{
// Add each child subnode as a partially populated ContextNode.
foreach (TreeNode documentSubNode in documentNode.Nodes)
{
// Get the DocumentNode data for the
DocumentNodeData subNodeData = documentSubNode.Tag as DocumentNodeData;
if (analyzerNode.SubNodes.IndexOf(nodeData.Id) != -1)
{
analyzerNode.CreatePartiallyPopulatedSubNode(
subNodeData.Type, subNodeData.Id, subNodeData.Location);
}
}
}
// Add links to the ContextNode.
this.AddLinksToAnalyzer(documentNode, analyzerNode, theInkAnalyzer);
// Update the partially populated flag.
analyzerNode.PartiallyPopulated = false;
System.Diagnostics.Debug.Unindent();
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0