ContextNode.IsConfirmed 方法
傳回布林值,這個值表示目前的 ContextNode 是否已確認具有指定的 ConfirmationType。
命名空間: System.Windows.Ink
組件: IAWinFX (在 IAWinFX.dll 中)
語法
'宣告
Public Function IsConfirmed ( _
type As ConfirmationType _
) As Boolean
'用途
Dim instance As ContextNode
Dim type As ConfirmationType
Dim returnValue As Boolean
returnValue = instance.IsConfirmed(type)
public bool IsConfirmed(
ConfirmationType type
)
public:
bool IsConfirmed(
ConfirmationType type
)
public boolean IsConfirmed(
ConfirmationType type
)
public function IsConfirmed(
type : ConfirmationType
) : boolean
參數
- type
型別:System.Windows.Ink.ConfirmationType
要在目前 ContextNode 上執行的確認類型。
傳回值
型別:System.Boolean
如果已確認 ContextNode 具有指定的 ConfirmationType,則為 true,否則為 false。
範例
下列範例允許使用者指出已經過正確分析的筆劃。這個範例是 InkCanvas (名為 theInkCanvas) 上之 PreviewMouseUp 事件的事件處理常式。選取 CheckBox (名為 confirmMode) 時,使用者按一下文字即可加以確認 (或在節點已經過確認時關閉確認)。這個範例會使用 StrokeCollection.HitTest(Point) 和 FindNodesOfType 尋找適合的節點。找到節點之後,範例就會呼叫 Confirm 以切換確認。最後會重建 TreeView 顯示哪些節點已經過確認,並且會處理 PreviewMouseUp 事件。
Sub theInkCanvas_PreviewMouseDown(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs)
If Me.confirmMode.IsChecked Then
' Find the ink word nodes that correspond to those strokes
Dim position As Point = e.GetPosition(theInkCanvas)
Dim hitStrokes As StrokeCollection = theInkCanvas.Strokes.HitTest(position)
Dim selectedNodes As ContextNodeCollection = _
Me.theInkAnalyzer.FindNodesOfType(ContextNodeType.InkWord, _
hitStrokes)
' Toggle the confirmation type on these nodes
Dim selectedNode As ContextNode
For Each selectedNode In selectedNodes
If selectedNode.IsConfirmed(ConfirmationType.NodeTypeAndProperties) Then
selectedNode.Confirm(ConfirmationType.None)
Else
selectedNode.Confirm(ConfirmationType.NodeTypeAndProperties)
End If
Next selectedNode
' Rebuild the TreeView to show which context nodes are confirmed.
Me.BuildTree()
' Handle the MouseDown event to prevent the InkCanvas from
' selecting the stroke.
e.Handled = True
End If
End Sub 'theInkCanvas_PreviewMouseDown
void theInkCanvas_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if ((bool)this.confirmMode.IsChecked)
{
// Find the ink word nodes that correspond to those strokes
Point position = e.GetPosition(theInkCanvas);
StrokeCollection hitStrokes = theInkCanvas.Strokes.HitTest(position);
ContextNodeCollection selectedNodes =
this.theInkAnalyzer.FindNodesOfType(ContextNodeType.InkWord,
hitStrokes);
// Toggle the confirmation type on these nodes
foreach (ContextNode selectedNode in selectedNodes)
{
if (selectedNode.IsConfirmed(ConfirmationType.NodeTypeAndProperties))
{
selectedNode.Confirm(ConfirmationType.None);
}
else
{
selectedNode.Confirm(ConfirmationType.NodeTypeAndProperties);
}
}
// Rebuild the TreeView to show which context nodes are confirmed.
this.BuildTree();
// Handle the MouseDown event to prevent the InkCanvas from
// selecting the stroke.
e.Handled = true;
}
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0