Bagikan melalui


DesignerGlyph.GetBounds(ActivityDesigner, Boolean) Metode

Definisi

Mengembalikan batas untuk glyph pada yang ditentukan ActivityDesigner.

public:
 virtual System::Drawing::Rectangle GetBounds(System::Workflow::ComponentModel::Design::ActivityDesigner ^ designer, bool activated);
public virtual System.Drawing.Rectangle GetBounds (System.Workflow.ComponentModel.Design.ActivityDesigner designer, bool activated);
abstract member GetBounds : System.Workflow.ComponentModel.Design.ActivityDesigner * bool -> System.Drawing.Rectangle
override this.GetBounds : System.Workflow.ComponentModel.Design.ActivityDesigner * bool -> System.Drawing.Rectangle
Public Overridable Function GetBounds (designer As ActivityDesigner, activated As Boolean) As Rectangle

Parameter

designer
ActivityDesigner

ActivityDesigner yang dengannya glyph dikaitkan.

activated
Boolean

true untuk menunjukkan apakah glyph muncul di permukaan perancang aktivitas; jika tidak, false.

Mengembalikan

Rectangle yang mewakili batasan untuk glyph.

Pengecualian

designer berisi referensi null (Nothing dalam Visual Basic).

Contoh

Contoh kode berikut menunjukkan bagaimana Anda dapat mengambil GetBounds alih metode . Kode mengatur ukuran dan lokasi objek glyph kustom.

Contoh kode ini adalah bagian dari Sampel SDK Monitor Alur Kerja dari file DesignerGlyphProvider.cs. Untuk informasi selengkapnya, lihat Monitor Alur Kerja.

public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
{
    Rectangle imageBounds = Rectangle.Empty;
    Image image = Resources.Executing;
    if (image != null)
    {
        Size glyphSize = WorkflowTheme.CurrentTheme.AmbientTheme.GlyphSize;
        imageBounds.Location = new Point(designer.Bounds.Right - glyphSize.Width / 2, designer.Bounds.Top - glyphSize.Height / 2);
        imageBounds.Size = glyphSize;
    }
    return imageBounds;
}
Public Overrides Function GetBounds(ByVal designer As System.Workflow.ComponentModel.Design.ActivityDesigner, ByVal activated As Boolean) As System.Drawing.Rectangle
    Dim imageBounds As Rectangle = Rectangle.Empty
    Dim image As Image = AppResources.Executing
    If Not image Is Nothing Then
        Dim glyphSize As Size = WorkflowTheme.CurrentTheme.AmbientTheme.GlyphSize
        imageBounds.Location = New Point(designer.Bounds.Right - glyphSize.Width / 2, designer.Bounds.Top - glyphSize.Height / 2)
        imageBounds.Size = glyphSize
    End If
    Return imageBounds
End Function

Keterangan

Kecuali ditimpa di kelas turunan, GetBounds mengembalikan batas perancang aktivitas yang terkait dengan glyph.

Berlaku untuk

Lihat juga