ShapeElement.ZOrder 속성

에이 셰이프가 다른 셰이프를 다이어그램에 표시 됩니다 순서를 결정 합니다.일반적으로 하위 도형의 순서를 설정 합니다.

네임스페이스:  Microsoft.VisualStudio.Modeling.Diagrams
어셈블리:  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.11.0(Microsoft.VisualStudio.Modeling.Sdk.Diagrams.11.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 네임스페이스