InkOverlaySelectionMovedEventArgs.OldSelectionBoundingRect 属性

获取所选 Strokes 集合在 SelectionMoved 事件激发之前的原始边框。

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

语法

声明
Public ReadOnly Property OldSelectionBoundingRect As Rectangle
用法
Dim instance As InkOverlaySelectionMovedEventArgs
Dim value As Rectangle

value = instance.OldSelectionBoundingRect
public Rectangle OldSelectionBoundingRect { get; }
public:
property Rectangle OldSelectionBoundingRect {
    Rectangle get ();
}
/** @property */
public Rectangle get_OldSelectionBoundingRect()
public function get OldSelectionBoundingRect () : Rectangle

属性值

类型:System.Drawing.Rectangle
所选 Strokes 集合在 SelectionMoved 事件激发之前的原始边框。

备注

OldSelectionBoundingRect 属性获取所选 Strokes 集合在 SelectionMoved 事件激发之前的位置。

示例

在此示例中,SelectionMoved 事件处理程序在所选内容移动之后检查该内容。如果移动了所选 Strokes 集合以使其任何部分位于窗口的左侧或顶部之外,则将所选内容移动回其原始位置。

Private Sub mInkObject_SelectionMoved(ByVal sender As Object, ByVal e As InkOverlaySelectionMovedEventArgs)
    ' mInkObject can be InkOverlay or InkPicture
    Dim newBounds As Rectangle = mInkObject.Selection.GetBoundingBox()
    ' Check if we have gone off the left or top sides of the window.
    If (newBounds.Left < 0 Or newBounds.Top < 0) Then
        ' Move to back to original spot
        mInkObject.Selection.Move(e.OldSelectionBoundingRect.Left - newBounds.Left, _
            e.OldSelectionBoundingRect.Top - newBounds.Top)
        ' Trick to insure that selection handles are updated
        mInkObject.Selection = mInkObject.Selection
    End If
End Sub
private void mInkObject_SelectionMoved(object sender, InkOverlaySelectionMovedEventArgs e)
{
    // mInkObject can be InkOverlay or InkPicture
    Rectangle newBounds = mInkObject.Selection.GetBoundingBox();

    // Check if we have gone off the left or top sides of the window.
    if (newBounds.Left < 0 || newBounds.Top < 0)
    {
        // Move to back to original spot
        mInkObject.Selection.Move(e.OldSelectionBoundingRect.Left - newBounds.Left,
            e.OldSelectionBoundingRect.Top - newBounds.Top);

        // Trick to insure that selection handles are updated
        mInkObject.Selection = mInkObject.Selection;
    }
}

平台

Windows Vista

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

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

InkOverlaySelectionMovedEventArgs 类

InkOverlaySelectionMovedEventArgs 成员

Microsoft.Ink 命名空间

InkOverlay

InkOverlay.SelectionMoved