BoundsRules 클래스
도형에 있을 수 있습니다 크기 수 제한 하는 규칙입니다.
상속 계층 구조
System.Object
Microsoft.VisualStudio.Modeling.Diagrams.BoundsRules
Microsoft.VisualStudio.Modeling.Diagrams.AvoidCornerRule
Microsoft.VisualStudio.Modeling.Diagrams.DefaultBoundsRules
Microsoft.VisualStudio.Modeling.Diagrams.KeepInParentRule
Microsoft.VisualStudio.Modeling.Diagrams.NoBoundsRules
Microsoft.VisualStudio.Modeling.Diagrams.PortMovementRule
Microsoft.VisualStudio.Modeling.Diagrams.SnapToGridRule
Microsoft.VisualStudio.Modeling.Diagrams.SnapToPerimeterFollowingRotationRule
네임스페이스: Microsoft.VisualStudio.Modeling.Diagrams
어셈블리: Microsoft.VisualStudio.Modeling.Sdk.Diagrams.11.0(Microsoft.VisualStudio.Modeling.Sdk.Diagrams.11.0.dll)
구문
‘선언
<SerializableAttribute> _
Public MustInherit Class BoundsRules
[SerializableAttribute]
public abstract class BoundsRules
BoundsRules 형식에서는 다음과 같은 멤버를 노출합니다.
생성자
이름 | 설명 | |
---|---|---|
![]() |
BoundsRules |
위쪽
메서드
이름 | 설명 | |
---|---|---|
![]() |
Equals | 지정한 개체와 현재 개체가 같은지 여부를 확인합니다. (Object에서 상속됨) |
![]() |
Finalize | 가비지 수집에서 회수하기 전에 개체에서 리소스를 해제하고 다른 정리 작업을 수행할 수 있게 합니다. (Object에서 상속됨) |
![]() |
GetCompliantBounds | 제안 된 크기를 조정 하 고이 범위 규칙을 따르지 않도록 위치를 조정 합니다.사용자가 마우스를 이동 하는 동안 반복 해 서 호출 됩니다.고스트 셰이프 사용자 규격 범위를 보여 줍니다. |
![]() |
GetHashCode | 특정 형식에 대한 해시 함수 역할을 합니다. (Object에서 상속됨) |
![]() |
GetType | 현재 인스턴스의 Type을 가져옵니다. (Object에서 상속됨) |
![]() |
MemberwiseClone | 현재 Object의 단순 복사본을 만듭니다. (Object에서 상속됨) |
![]() |
ToString | 현재 개체를 나타내는 문자열을 반환합니다. (Object에서 상속됨) |
위쪽
설명
A 범위 규칙 크기와 셰이프의 위치에 한계를 정의 하는 클래스입니다.GetCompliantBounds반복 하 여 셰이프 모서리 또는 면 도형 사용자가 드래그 되는 동안 호출 됩니다.
자세한 내용은 BoundsRules로 모양 위치 및 크기 제한를 참조하십시오.
예제
다음은 직사각형의 고정 된 크기를 가로 또는 세로 막대의 수를 제한 합니다.모서리 또는 면 사용자를 끌 때 아웃 라인 높이의 두 가지 허용 된 구성 및 너비 간의 대칭 이동 합니다.
원하는 경우의 위치와 크기를 제한 수 있습니다.
범위 규칙 클래스와에서 셰이프 인스턴스를 만듭니다.
using Microsoft.VisualStudio.Modeling.Diagrams; ...
public partial class BarShape
{
/// <summary>
/// Rule invoked when the user is resizing a shape.
/// </summary>
public override BoundsRules BoundsRules
{ get { return new BarBoundsRule(); } }
}
/// <summary>
/// Rule invoked when the user is changing a shape's outline.
/// Provides real-time mouse rubber-band feedback, so must work fast.
/// </summary>
public class BarBoundsRule: BoundsRules
{
public override RectangleD GetCompliantBounds
(ShapeElement shape, RectangleD proposedBounds)
{
double thickness = 0.1;
if (proposedBounds.Height > proposedBounds.Width)
{
// There is a minimum width for a shape; the width
// will actually be set to the lesser of
// thickness and that minimum.
return new RectangleD(proposedBounds.Location,
new SizeD(thickness, proposedBounds.Height));
}
else
{
// There is a minimum height for a shape; the
// height will actually be set to the lesser of
// thickness and that minimum.
return new RectangleD(proposedBounds.Location,
new SizeD(proposedBounds.Width, thickness));
} } }
스레드로부터의 안전성
이 형식의 모든 공용 static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.
참고 항목
참조
Microsoft.VisualStudio.Modeling.Diagrams 네임스페이스