ActivityDesigner.ImageRectangle 属性

定义

获取与设计器关联的图像的环绕边界值(以逻辑坐标表示)。

protected:
 virtual property System::Drawing::Rectangle ImageRectangle { System::Drawing::Rectangle get(); };
protected virtual System.Drawing.Rectangle ImageRectangle { get; }
member this.ImageRectangle : System.Drawing.Rectangle
Protected Overridable ReadOnly Property ImageRectangle As Rectangle

属性值

Rectangle 图像。

示例

下面的示例演示如何重写 ImageRectangle 属性。 在此示例中,使用 ImageRectangle 的边界来计算 ActivityDesigner

protected override Rectangle ImageRectangle
{
    get
    {
        Rectangle bounds = this.Bounds;
        Size sz = new Size(24, 24);

        Rectangle imageRect = new Rectangle();
        imageRect.X = bounds.Left + ((bounds.Width - sz.Width) / 2);
        imageRect.Y = bounds.Top + 4;
        imageRect.Size = sz;

        return imageRect;
    }
}
Protected Overrides ReadOnly Property ImageRectangle() As Rectangle

    Get
        Dim Bounds As Rectangle = Me.Bounds
        Dim sz As New Size(24, 24)

        Dim imageRect As New Rectangle()
        imageRect.X = Bounds.Left + ((Bounds.Width - sz.Width) / 2)
        imageRect.Y = Bounds.Top + 4
        imageRect.Size = sz

        Return imageRect
    End Get
End Property

注解

使用 ImageRectangle 可检索包含与设计器关联的图像的矩形的坐标。 可以使用这些坐标绘制连接器或覆盖图形。

适用于