次の方法で共有


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

パラメータ

戻り値

型 : System.Boolean
指定した ConfirmationTypeContextNode が確認される場合は true。それ以外の場合は false。

次の例では、ユーザーは正常に分析されているストロークを指定できます。この例は、theInkCanvas という名前の InkCanvas での PreviewMouseUp イベントのイベント ハンドラです。confirmMode という名前の CheckBox がオンの場合、ユーザーは単語をクリックして確認します (または、ノードが既に確認済みの場合は確認を無効にします)。この例では、StrokeCollection.HitTest(Point) および FindNodesOfType を使用して、適切なノードを検索します。ノードが見つかったら、Confirm を呼び出して確認を切り替えます。最後に、確認されたノードと、PreviewMouseUp イベントが処理されることを示す TreeView が再構築されます。

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

参照

参照

ContextNode クラス

ContextNode メンバ

System.Windows.Ink 名前空間