InkOverlaySelectionMovingEventHandler 委托

表示处理 InkOverlay 对象的 SelectionMoving 事件的方法。

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink(在 Microsoft.Ink.dll 中)

语法

声明
Public Delegate Sub InkOverlaySelectionMovingEventHandler ( _
    sender As Object, _
    e As InkOverlaySelectionMovingEventArgs _
)
用法
Dim instance As New InkOverlaySelectionMovingEventHandler(AddressOf HandlerMethod)
public delegate void InkOverlaySelectionMovingEventHandler(
    Object sender,
    InkOverlaySelectionMovingEventArgs e
)
public delegate void InkOverlaySelectionMovingEventHandler(
    Object^ sender, 
    InkOverlaySelectionMovingEventArgs^ e
)
/** @delegate */
public delegate void InkOverlaySelectionMovingEventHandler(
    Object sender,
    InkOverlaySelectionMovingEventArgs e
)
JScript 不支持委托。

参数

备注

如果当前所选内容的位置将发生更改(例如通过修改用户界面、剪切粘贴过程或 Selection 属性进行更改),则会发生 SelectionMoving 事件。

创建 InkOverlaySelectionMovingEventHandler 委托时,需要标识将处理该事件的方法。若要将该事件与事件处理程序关联,请将该委托的一个实例添加到事件中。除非移除了该委托,否则每当发生该事件时就会调用此事件处理程序。出于性能方面的原因,默认事件关注在托管代码 中处于关闭状态,但如果添加事件处理程序,它将自动打开。

示例

在下面的示例中,SelectionMoving 事件处理程序在所选内容移动之前检查该内容。如果所选内容的任何部分移动到窗口边界之外,则事件处理程序将通过更改每个所选 Stroke 对象的 Color 属性,将所选内容的颜色更改为红色。

Private Sub mInkObject_SelectionMoving(ByVal sender As Object, ByVal e As InkOverlaySelectionMovingEventArgs)
    If e.NewPixelRect.Left < 0 Or e.NewPixelRect.Top < 0 Or _
       e.NewPixelRect.Right > mInkObject.AttachedControl.ClientRectangle.Width Or _
       e.NewPixelRect.Bottom > mInkObject.AttachedControl.ClientRectangle.Height Then

        For Each stroke As Stroke In mInkObject.Selection
            ' change the stroke color
            stroke.DrawingAttributes.Color = Color.Red
        Next

    End If
End Sub
private void mInkObject_SelectionMoving(object sender, InkOverlaySelectionMovingEventArgs e)
{
    if (e.NewPixelRect.Left < 0 || e.NewPixelRect.Top < 0 ||
        e.NewPixelRect.Right > mInkObject.AttachedControl.ClientRectangle.Width ||
        e.NewPixelRect.Bottom > mInkObject.AttachedControl.ClientRectangle.Height)
    {
        foreach (Stroke stroke in mInkObject.Selection)
        {
            // change the stroke color
            stroke.DrawingAttributes.Color = Color.Red;
        }
    }
}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

Microsoft.Ink 命名空间

System.Drawing.Rectangle

InkOverlay.Selection