DesignerGlyph.GetBounds(ActivityDesigner, Boolean) Método

Definição

Retorna os limites para o glifo no ActivityDesigner especificado.

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

Parâmetros

designer
ActivityDesigner

O ActivityDesigner ao qual o glifo é associado.

activated
Boolean

true para indicar se o glifo aparece na superfície do designer de atividade; caso contrário, false.

Retornos

Um Rectangle que representa os limites do glifo.

Exceções

designer contém uma referência nula (Nothing no Visual Basic).

Exemplos

O exemplo de código a seguir demonstra como você pode substituir o GetBounds método . O código define o tamanho e o local do objeto de glifo personalizado.

Este exemplo de código faz parte do Exemplo do SDK do Monitor de Fluxo de Trabalho do arquivo DesignerGlyphProvider.cs. Para obter mais informações, consulte Monitor de Fluxo de Trabalho.

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

Comentários

A menos que substituído em uma classe derivada, GetBounds retorna os limites do designer de atividade ao qual o glifo está associado.

Aplica-se a

Confira também