InkCanvas.StrokeCollected 事件


在将用户绘制的笔画添加到 Strokes 属性时发生。Occurs when a stroke drawn by the user is added to the Strokes property.

 event System::Windows::Controls::InkCanvasStrokeCollectedEventHandler ^ StrokeCollected;
public event System.Windows.Controls.InkCanvasStrokeCollectedEventHandler StrokeCollected;
member this.StrokeCollected : System.Windows.Controls.InkCanvasStrokeCollectedEventHandler 
Public Custom Event StrokeCollected As InkCanvasStrokeCollectedEventHandler 




下面的示例在用户向添加笔画时将时间作为自定义属性保存 InkCanvasThe following example saves the time as a custom property when a user adds a stroke to the InkCanvas.

Guid currentTimeGuid = new Guid("12345678-1234-1234-1234-123456789012");

void inkCanvas1_StrokeCollected(object sender, InkCanvasStrokeCollectedEventArgs e)
    e.Stroke.AddPropertyData(currentTimeGuid, DateTime.Now);

Private currentTimeGuid As New Guid("12345678-1234-1234-1234-123456789012")

Private Sub inkCanvas1_StrokeCollected(ByVal sender As Object, ByVal e As InkCanvasStrokeCollectedEventArgs)

    e.Stroke.AddPropertyData(currentTimeGuid, DateTime.Now)

End Sub


当用户使用指针设备完成笔划时,将引发此事件。This event is raised when a user completes a stroke using a pointing device. 例如,用户可能会在进行运动后从数字化仪引发触笔,从而完成笔画。For example, a user might raise a stylus from a digitizer after making a motion, thereby completing a stroke.

事件处理程序接收类型的参数 InkCanvasStrokeCollectedEventArgs ,该参数引用完成的笔画。The event handler receives an argument of type InkCanvasStrokeCollectedEventArgs, which references the completed stroke. 笔划还会添加到 Strokes 的属性中 InkCanvasThe stroke is also added to the Strokes property of the InkCanvas.

以编程方式将 Stroke 对象添加到 Strokes 集合不会引发此事件。The programmatic addition of a Stroke object to the Strokes collection does not raise this event.

路由事件信息Routed Event Information

标识符字段Identifier field StrokeCollectedEvent
路由策略Routing strategy 冒泡Bubbling
委托Delegate InkCanvasStrokeCollectedEventHandler