共用方式為


InkOverlaySelectionResizingEventHandler 委派

表示處理 InkOverlay 物件之 SelectionResizing 事件的方法。

命名空間:  Microsoft.Ink
組件:  Microsoft.Ink (在 Microsoft.Ink.dll 中)

語法

'宣告
Public Delegate Sub InkOverlaySelectionResizingEventHandler ( _
    sender As Object, _
    e As InkOverlaySelectionResizingEventArgs _
)
'用途
Dim instance As New InkOverlaySelectionResizingEventHandler(AddressOf HandlerMethod)
public delegate void InkOverlaySelectionResizingEventHandler(
    Object sender,
    InkOverlaySelectionResizingEventArgs e
)
public delegate void InkOverlaySelectionResizingEventHandler(
    Object^ sender, 
    InkOverlaySelectionResizingEventArgs^ e
)
/** @delegate */
public delegate void InkOverlaySelectionResizingEventHandler(
    Object sender,
    InkOverlaySelectionResizingEventArgs e
)
JScript 不支援委派。

參數

備註

當目前選取範圍的大小即將變更 (例如透過更改使用者介面、剪貼程序或 Selection 屬性等方式) 時,就會發生 SelectionResizing 事件。

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

範例

在這個範例中,SelectionResizing 事件處理常式會在選取範圍調整大小之前檢查它。如果選取範圍將會調整大小,使其任何部分位於視窗界限之外,則事件處理常式會藉由變更每個選取的 Stroke 物件的 Color 屬性,而將選取範圍轉變為紅色。

Private Sub mInkObject_SelectionResizing(ByVal sender As Object, ByVal e As InkOverlaySelectionResizingEventArgs)
    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_SelectionResizing(object sender, InkOverlaySelectionResizingEventArgs 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