ConfirmationType 枚举
定义用于指定可以在 ContextNodeBase 对象上发生的类型确认的值。
此枚举有一个 FlagsAttribute 属性,通过该属性可使其成员值按位组合。
命名空间: System.Windows.Ink.AnalysisCore
程序集: IACore(在 IACore.dll 中)
语法
声明
<FlagsAttribute> _
Public Enumeration ConfirmationType
用法
Dim instance As ConfirmationType
[FlagsAttribute]
public enum ConfirmationType
[FlagsAttribute]
public enum class ConfirmationType
/** @attribute FlagsAttribute */
public enum ConfirmationType
public enum ConfirmationType
成员
成员名称 | 说明 | |
---|---|---|
None | 指定不应用任何确认。InkAnalyzer 可以根据需要自由更改上下文节点或其任何后代。 | |
NodeTypeAndProperties | 指定 InkAnalyzer 不能更改指定上下文节点的类型或任何属性。 | |
TopBoundary | 指定 InkAnalyzerBase 不执行导致 TopBoundary 移出当前上边界的操作(包括添加墨迹或与其他 ContextNodeBase 合并)。例如: |
备注
只能对 InkWord 和 InkDrawing 类型的 ContextNodeBase 对象使用 NodeTypeAndProperties。否则会引发 InvalidOperationException。
示例
下面的示例是 Panel(名为 theNotesPanel)上的 MouseUp 事件的事件处理程序,该处理程序通过名为 theInkCollector 的 InkCollector 收集墨迹。应用程序有一个 Boolean 值 confirmMode,该值由名为 confirmMenuItem 的 MenuItem 设置。在“确认”模式中,用户单击单词以确认它(或者,如果已经确认节点,则关闭确认)。该示例将 MouseUp 事件转换为墨迹坐标,使用 HitTest 和 FindNodesOfType 查找相应的节点。在找到节点之后,调用 Confirm 以切换确认。最后,应用程序脱离“确认”模式。
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)
' The integer array must be exactly the right size. Arrays
' begin at zero, so the upper bound is selectedStrokes.Count - 1.
Dim selectedStrokeIds(selectedStrokes.Count - 1) As Integer
For i As Integer = 0 To selectedStrokes.Count - 1
selectedStrokeIds(i) = selectedStrokes(i).Id
Next
' Find the ink word nodes that correspond to those strokes
Dim selectedNodes As ContextNodeBaseCollection = _
Me.theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkWord, _
selectedStrokeIds)
' Toggle the confirmation type on these nodes
Dim selectedNode As ContextNodeBase
For Each selectedNode In selectedNodes
If selectedNode.IsConfirmed( _
Windows.Ink.AnalysisCore.ConfirmationType.NodeTypeAndProperties) Then
selectedNode.Confirm(System.Windows.Ink.AnalysisCore.ConfirmationType.None)
Else
selectedNode.Confirm(System.Windows.Ink.AnalysisCore.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);
int[] selectedStrokeIds = new int[selectedStrokes.Count];
for (int i = 0; i < selectedStrokes.Count; i++)
{
selectedStrokeIds[i] = selectedStrokes[i].Id;
}
// Find the ink word nodes that correspond to those strokes
ContextNodeBaseCollection selectedNodes =
this.theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkWord,
selectedStrokeIds);
// Toggle the confirmation type on these nodes
foreach (ContextNodeBase selectedNode in selectedNodes)
{
if (selectedNode.IsConfirmed(
System.Windows.Ink.AnalysisCore.ConfirmationType.NodeTypeAndProperties))
{
selectedNode.Confirm(System.Windows.Ink.AnalysisCore.ConfirmationType.None);
}
else
{
selectedNode.Confirm(System.Windows.Ink.AnalysisCore.ConfirmationType.NodeTypeAndProperties);
}
}
// No longer in "confirm" mode
this.confirmMode = false;
this.confirmMenuItem.Checked = false;
this.theInkCollector.Enabled = true;
}
}
平台
Windows Vista, Windows XP SP2, Windows Server 2003
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0
另请参见
参考
System.Windows.Ink.AnalysisCore 命名空间
ContextNodeBaseIsNodeTypeAndPropertiesConfirmed()