다음을 통해 공유


ShapeElement.ZOrder 속성

이 모양이 다이어그램의 다른 모양에 상대적으로 표시되는 순서를 확인합니다. 일반적으로 자식 모양의 순서에 따라 설정됩니다.

네임스페이스:  Microsoft.VisualStudio.Modeling.Diagrams
어셈블리:  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.12.0(Microsoft.VisualStudio.Modeling.Sdk.Diagrams.12.0.dll)

구문

‘선언
Public Overridable Property ZOrder As Double
public virtual double ZOrder { get; set; }

속성 값

형식: System.Double

설명

다이어그램의 모든 셰이프는 ZOrder 그리기 프로세스의 일부로 설정 하는 때문에 값을 직접 설정 하려면 권장 됩니다. 대신 셰이프에 표시 되는 순서를 변경 하려면 도형을 순서는 NestedChildShapes또는 RelativeChildShapes, 다음 호출 shape.Diagram.NeedsRenumber = true. 이 다이어그램에서 ZOrders을 다시 설정 합니다. 다음 예제를 참조하십시오.

예제

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

셰이프를 다이어그램의 상단에 항상 표시 되는지 확인 하려면 다음과 같이이 속성을 재정의할 수 있습니다.

/// <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 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

ShapeElement 클래스

Microsoft.VisualStudio.Modeling.Diagrams 네임스페이스