InkCanvas.SelectionChanging 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在选择了一组新墨迹笔画和/或元素时发生。
public:
event System::Windows::Controls::InkCanvasSelectionChangingEventHandler ^ SelectionChanging;
public event System.Windows.Controls.InkCanvasSelectionChangingEventHandler SelectionChanging;
member this.SelectionChanging : System.Windows.Controls.InkCanvasSelectionChangingEventHandler
Public Custom Event SelectionChanging As InkCanvasSelectionChangingEventHandler
Public Event SelectionChanging As InkCanvasSelectionChangingEventHandler
事件类型
示例
以下示例使所选笔划成为蓝色。
void inkCanvas1_SelectionChanging(object sender, InkCanvasSelectionChangingEventArgs e)
{
StrokeCollection selectedStrokes = e.GetSelectedStrokes();
foreach (Stroke aStroke in inkCanvas1.Strokes)
{
if (selectedStrokes.Contains(aStroke))
{
aStroke.DrawingAttributes.Color = Colors.RoyalBlue;
}
else
{
aStroke.DrawingAttributes.Color = inkCanvas1.DefaultDrawingAttributes.Color;
}
}
}
Private Sub inkCanvas1_SelectionChanging(ByVal sender As Object, _
ByVal e As InkCanvasSelectionChangingEventArgs)
Dim selectedStrokes As StrokeCollection = e.GetSelectedStrokes()
Dim aStroke As Stroke
For Each aStroke In inkCanvas1.Strokes
If selectedStrokes.Contains(aStroke) Then
aStroke.DrawingAttributes.Color = Colors.RoyalBlue
Else
aStroke.DrawingAttributes.Color = inkCanvas1.DefaultDrawingAttributes.Color
End If
Next aStroke
End Sub
注解
当用户 SelectionChanging 选择笔划和/或元素时,但在应用更改之前,将引发该事件。
接收 SelectionChanging 对象时InkCanvasSelectionChangingEventHandlerInkCanvasSelectionChangingEventArgs,将处理 事件。 InkCanvasSelectionChangingEventArgs 提供在用户选择和 对象后用于访问 FrameworkElement 和 StrokeCollection 对象的方法。
应用更改后,将 SelectionChanged 引发 事件。
注意
删除 SelectionChanging 所选笔划或更改属性时 ActiveEditingMode ,不会发生该事件。