ContextNode.IsConfirmed-Methode
Ruft einen Wert ab, der angibt, ob das ContextNode-Objekt bestätigt wurde. InkAnalyzer kann den Knotentyp und die zugeordneten Striche für bestätigte Objekte nicht ändern.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)
Syntax
'Declaration
Public Function IsConfirmed ( _
type As ConfirmationType _
) As Boolean
'Usage
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
Parameter
- type
Typ: Microsoft.Ink.ConfirmationType
Der Bestätigungstyp, anhand dessen der Wert überprüft werden soll.
Rückgabewert
Typ: System.Boolean
true , wenn der Knotentyp bestätigt wurde, andernfalls false.
Beispiele
Im folgenden Beispiel wird der Bestätigungszustand des ContextNode mit der IsConfirmed()-Methode gewechselt. Das Beispiel ist ein Ereignishandler für das Control.MouseUp-Ereignis an einem Panel mit dem Namen theNotesPanel, das Freihandeingaben über einen InkCollector mit dem Namen theInkCollector erfasst. Die Anwendung verfügt über einen Wert Boolean mit dem Namen confirmMode, der durch ein MenuItem mit dem Namen confirmMenuItem festgelegt wird. Im "Bestätigungsmodus" klickt der Benutzer auf ein Wort, um es zu bestätigen (oder um die Bestätigung zu deaktivieren, wenn der Knoten bereits bestätigt wurde). Im Beispiel wird das beim Loslassen der Maustaste ausgelöste Ereignis in Freihandkoordinaten konvertiert. Es werden HitTest und FindNodesOfType verwendet, um die entsprechenden Knoten zu suchen. Nachdem die Knoten gefunden wurden, wird Confirm aufgerufen, um die Bestätigung umzuschalten. Schließlich wechselt die Anwendung aus dem "Bestätigungsmodus".
Private Sub theNotesPanel_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles theNotesPanel.MouseUp
If Me.confirmMode = True Then
' Translate coordinates into ink dimensions
Dim hitPoint As New Point(e.X, e.Y)
Dim panelGraphics As Graphics = Me.theNotesPanel.CreateGraphics()
Me.theInkCollector.Renderer.PixelToInkSpace(panelGraphics, hitPoint)
panelGraphics.Dispose()
' Find the strokes that the user selected
Dim selectedStrokes As Strokes = Me.theInkCollector.Ink.HitTest(hitPoint, 10)
' Find the ink word nodes that correspond to those strokes
Dim selectedNodes As ContextNodeCollection = _
Me.theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.InkWord, _
selectedStrokes)
' Toggle the confirmation type on these nodes
Dim selectedNode As ContextNode
For Each selectedNode In selectedNodes
If selectedNode.IsConfirmed(ConfirmationType.NodeTypeAndProperties) = True Then
selectedNode.Confirm(Microsoft.Ink.ConfirmationType.None)
Else
selectedNode.Confirm(Microsoft.Ink.ConfirmationType.NodeTypeAndProperties)
End If
Next selectedNode
' No longer in "confirm" mode
Me.confirmMode = False
Me.ConfirmMenuItem.Checked = False
Me.theInkCollector.Enabled = True
End If
End Sub
private void theNotesPanel_MouseUp(object sender, MouseEventArgs e)
{
if (this.confirmMode)
{
// Translate coordinates into ink dimensions
Point hitPoint = new Point(e.X, e.Y);
Graphics panelGraphics = this.theNotesPanel.CreateGraphics();
this.theInkCollector.Renderer.PixelToInkSpace(panelGraphics, ref hitPoint);
panelGraphics.Dispose();
// Find the strokes that the user selected
Strokes selectedStrokes = this.theInkCollector.Ink.HitTest(hitPoint, 10);
// Find the ink word nodes that correspond to those strokes
ContextNodeCollection selectedNodes =
this.theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.InkWord,
selectedStrokes);
// Toggle the confirmation type on these nodes
foreach (ContextNode selectedNode in selectedNodes)
{
if (selectedNode.IsConfirmed(ConfirmationType.NodeTypeAndProperties))
{
selectedNode.Confirm(Microsoft.Ink.ConfirmationType.None);
}
else
{
selectedNode.Confirm(Microsoft.Ink.ConfirmationType.NodeTypeAndProperties);
}
}
// No longer in "confirm" mode
this.confirmMode = false;
this.confirmMenuItem.Checked = false;
this.theInkCollector.Enabled = true;
}
}
Plattformen
Windows Vista
.NET Framework und .NET Compact Framework unterstützen nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.
Versionsinformationen
.NET Framework
Unterstützt in: 3.0