ShapeField.AnchoringBehavior 속성

필드의 내용은 해야 및 위치 ShapeElement 부모를 기준으로 크기를 조정할지 설명 합니다.

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

구문

‘선언
Public ReadOnly Property AnchoringBehavior As AnchoringBehavior
public AnchoringBehavior AnchoringBehavior { get; }

속성 값

형식: Microsoft.VisualStudio.Modeling.Diagrams.AnchoringBehavior

설명

Shapefield의 해야 하며 위치를 부모 및 형제 ShapeElements 기준으로 크기를 조정할지는 Anchoringbehavior을 설명 합니다.

기본 고정 동작을 변경 하려면

  1. 설정의 생성 이중 파생 된 도형의 속성 클래스는 DSL 정의에 후 클릭 모든 템플릿 변환.

  2. 재정의 InitializeDecorators() 셰이프 클래스에 있습니다.

    • DSL 프로젝트에 파일을 만들 및 모양 클래스에 대 한 partial 클래스 정의 추가 합니다.해당 클래스의 메서드를 삽입 합니다.
  3. 호출의 SetAnchor 메서드는 AnchoringBehavior 개체.

예제

기본적으로 텍스트 필드는 한 줄만 표시 됩니다.그러나이 예제에서는 "여러 줄으로 줄 바꿈됩니다." 텍스트를 사용자가 입력할 수 있는 셰이프를 정의 합니다.줄 바꿈 동작을 확인 하려면, 우리가 필드는 셰이프의 옆면을 고정 해야 합니다.

주의 정보주의

이 코드는 최소한의 언어 솔루션 템플릿에서 만든 DSL을 작동 합니다.추가 데코레이터 라고 CommentDecorator 에 ExampleShape, 도메인 클래스의 문자열 속성에 연결 하 고 ExampleElement.설정의 생성 이중 파생 된 속성에 대 한 ExampleShape DSL 정의에 있도록는 InitializeDecorators 메서드를 재정의할 수 있습니다.

  public partial class ExampleShape
  {
    // Called once for each shape instance, after InitializeShapeFields
    protected override void InitializeDecorators
      (IList<ShapeField> shapeFields, IList<Decorator> decorators)
    { // Be sure to call the base method.
      base.InitializeDecorators(shapeFields, decorators);
      // Look up the shape field, which is called "CommentDecorator":
      TextField commentField = (TextField)ShapeElement.FindShapeField(shapeFields, "CommentDecorator");
      TextField nameField = (TextField)ShapeElement.FindShapeField(shapeFields, "NameDecorator");
      // Allow multiple lines of text in the field.
      commentField.DefaultMultipleLine = true;
      // Autosize is not supported for multi-line   fields.
      commentField.DefaultAutoSize = false;
      // Anchor the field slightly inside the container shape.
      commentField.AnchoringBehavior.Clear();
      commentField.AnchoringBehavior.
        SetLeftAnchor(AnchoringBehavior.Edge.Left, 0.01);
      commentField.AnchoringBehavior.
        SetRightAnchor(AnchoringBehavior.Edge.Right, 0.01);
      commentField.AnchoringBehavior.
        SetTopAnchor(nameField, AnchoringBehavior.Edge.Bottom, 0.01);
      commentField.AnchoringBehavior.
        SetBottomAnchor(AnchoringBehavior.Edge.Bottom, 0.01);
    }
  }

.NET Framework 보안

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

참고 항목

참조

ShapeField 클래스

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