Aracılığıyla paylaş


ShapeElement.ZOrder Özellik

Bu şekil içinde göreli olarak diğer şekilleri diyagram üzerinde görüntülenecek sırayı belirler.Normal olarak alt şekiller siparişinden ayarlayın.

Ad alanı:  Microsoft.VisualStudio.Modeling.Diagrams
Derleme:  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.11.0 (Microsoft.VisualStudio.Modeling.Sdk.Diagrams.11.0.dll içinde)

Sözdizimi

'Bildirim
Public Overridable Property ZOrder As Double
public virtual double ZOrder { get; set; }

Özellik Değeri

Tür: System.Double

Notlar

Diyagramdaki tüm şekillerin ZOrder boyama işleminin bir parçası ayarlaması nedeniyle değer doğrudan ayarlanmamış önerilir.Bunun yerine, şekilleri görüntülenme sırasını değiştirmek için şekiller yeniden NestedChildShapesveya RelativeChildShapesve sonra call shape.Diagram.NeedsRenumber = true.Bu diyagram ZOrders sıfırlar emin olmayı sağlar.Aşağıdaki örneklere bakın.

Örnekler

    /// <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();
          }
        }

Şeklinizin her zaman diyagramın en üstünde görünür olduğundan emin olmak için bu özellik şu şekilde kılabilirsiniz.

/// <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
}

.NET Framework Güvenliği

Ayrıca bkz.

Başvuru

ShapeElement Sınıf

Microsoft.VisualStudio.Modeling.Diagrams Ad Alanı