ShapeElement.ZOrder (Propiedad)

Determina el orden en el que esta forma se mostrará en relación con otras formas en el diagrama.Establece normalmente de orden de formas secundarias.

Espacio de nombres:  Microsoft.VisualStudio.Modeling.Diagrams
Ensamblado:  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.11.0 (en Microsoft.VisualStudio.Modeling.Sdk.Diagrams.11.0.dll)

Sintaxis

'Declaración
Public Overridable Property ZOrder As Double
public virtual double ZOrder { get; set; }

Valor de propiedad

Tipo: System.Double

Comentarios

Se recomienda para no establecer el valor directamente, porque el diagrama establece el ZOrder de todas sus formas como parte del proceso de dibujo.En su lugar, para cambiar el orden en que las formas se muestran, puede reordenar las formas en NestedChildShapeso RelativeChildShapes, y llamar a continuación a shape.Diagram.NeedsRenumber = true.Esto asegura que el diagrama restaure el ZOrders.Vea el ejemplo siguiente.

Ejemplos

    /// <summary>
    /// Command to send current shapes to the back.
    /// </summary>
    private void OnMenuSendShapesToBackCommand(object sender, EventArgs e)
    {
      MenuCommand command = sender as MenuCommand;
      Store store = this.CurrentDocData.Store;
      foreach (object selectedItem in this.CurrentSelection)
      {
        ShapeElement shape = selectedItem as ShapeElement;
        if (shape == null || shape.ParentShape == null) continue;
        if (shape.IsNestedChild)
        {
          using (Transaction t = store.TransactionManager.BeginTransaction("sendToBack"))
          {
            // Make the current shape the first in the list.
            shape.ParentShape.NestedChildShapes.Move(shape, 0);
            // Update the ZOrder of the shapes to reflect the change.
            shape.Diagram.NeedsRenumber = true;
            // Make sure the shape is redrawn:
            shape.Invalidate();
            t.Commit();
          }
        }

Para asegurarse de que la forma aparece siempre en la parte superior del diagrama, puede reemplazar esta propiedad como sigue.

/// <summary>
/// Gets the relative Z-Order for this ShapeElement.
/// Make sure that my shape stays above all other diagram elements.
///  Add a million to the Z-Order that we are given.
/// </summary>
public override double ZOrder
{
  get
  {
    return base.ZOrder + 1e6;
  }
  // leave set{ } as inherited
}

Seguridad de .NET Framework

Vea también

Referencia

ShapeElement Clase

Microsoft.VisualStudio.Modeling.Diagrams (Espacio de nombres)