共用方式為


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 委派 (Delegate) 時,您要識別處理事件的方法。若要使事件與您的事件處理常式產生關聯,請將委派的執行個體加入至事件。除非您移除委派,否則每當事件發生時就會呼叫事件處理常式。基於效能考量,「Managed 程式碼」中相關事件的預設是關閉的,但會在您加入事件處理常式時自動開啟。

範例

在這個範例中,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