次の方法で共有


InkPicture.SelectionMoving イベント

ユーザー インターフェイスの変更、切り取りと貼り付けの操作、または Selection プロパティなどによって現在の選択内容の位置が変更されるときに発生します。

名前空間 :  Microsoft.Ink
アセンブリ :  Microsoft.Ink (Microsoft.Ink.dll 内)

構文

'宣言
Public Event SelectionMoving As InkOverlaySelectionMovingEventHandler
'使用
Dim instance As InkPicture
Dim handler As InkOverlaySelectionMovingEventHandler

AddHandler instance.SelectionMoving, handler
public event InkOverlaySelectionMovingEventHandler SelectionMoving
public:
 event InkOverlaySelectionMovingEventHandler^ SelectionMoving {
    void add (InkOverlaySelectionMovingEventHandler^ value);
    void remove (InkOverlaySelectionMovingEventHandler^ value);
}
/** @event */
public void add_SelectionMoving (InkOverlaySelectionMovingEventHandler value)
/** @event */
public void remove_SelectionMoving (InkOverlaySelectionMovingEventHandler value)
JScript では、イベントは使用できません。

解説

イベント ハンドラは、このイベントについてのデータを格納している InkOverlaySelectionMovingEventArgs 型の引数を受け取ります。

InkOverlaySelectionMovingEventHandler デリゲートを作成する場合は、イベントを処理するメソッドを指定します。イベントをイベント ハンドラに関連付けるには、デリゲートのインスタンスをイベントに追加します。デリゲートを削除しない限り、そのイベントが発生すると常にイベント ハンドラが呼び出されます。パフォーマンス上の理由から、既定のイベント対象は無効ですが、イベント ハンドラを追加すると、自動的に有効になります。

この例では、SelectionMoving イベント ハンドラが、移動される前に選択を調べます。一部がウィンドウの境界の外側になるように選択が移動される場合、イベント ハンドラは、選択された各 Stroke オブジェクトの Color プロパティを変更し、選択を赤で表示します。

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

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

    End If
End Sub
private void mInkPicture_SelectionMoving(object sender, InkOverlaySelectionMovingEventArgs e)
{
    if (e.NewPixelRect.Left < 0 || e.NewPixelRect.Top < 0 ||
        e.NewPixelRect.Right > mInkPicture.ClientRectangle.Width ||
        e.NewPixelRect.Bottom > mInkPicture.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

参照

参照

InkPicture クラス

InkPicture メンバ

Microsoft.Ink 名前空間

InkOverlaySelectionMovedEventArgs

InkPicture.Selection

InkPicture.SelectionMoved