ContextNode.IsConfirmed 메서드
업데이트: 2007년 11월
현재 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입니다.
예제
다음 예제에서는 사용자가 올바르게 분석된 스트로크를 나타낼 수 있습니다. 이 예제는 이름이 theInkCanvas인 InkCanvas에 대한 PreviewMouseUp 이벤트의 이벤트 처리기입니다. 이름이 confirmMode인 CheckBox를 선택한 경우 사용자는 단어를 클릭하여 해당 단어를 확인합니다(또는 노드가 이미 확인된 경우에는 확인을 해제). 이 예제에서는 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에서 지원