Rect 생성자

정의

Rect 구조체의 새 인스턴스를 초기화합니다.

오버로드

Rect(Size)

지정된 크기를 가지며 위치가 (0,0)인 Rect 구조체의 새 인스턴스를 초기화합니다.

Rect(Point, Point)

지정된 두 지점을 정확히 포함할 수 있는 크기의 Rect 구조체의 새 인스턴스를 초기화합니다.

Rect(Point, Size)

지정된 왼쪽 위 모퉁이 좌표 및 지정된 너비와 높이를 갖는 Rect 구조체의 새 인스턴스를 초기화합니다.

Rect(Point, Vector)

지정된 지점 및 지정된 지점과 지정된 벡터의 합을 정확히 포함할 수 있는 크기의 Rect 구조체의 새 인스턴스를 초기화합니다.

Rect(Double, Double, Double, Double)

지정된 x좌표, y좌표, 너비 및 높이를 갖는 Rect 구조체의 새 인스턴스를 초기화합니다.

Rect(Size)

지정된 크기를 가지며 위치가 (0,0)인 Rect 구조체의 새 인스턴스를 초기화합니다.

public:
 Rect(System::Windows::Size size);
public Rect (System.Windows.Size size);
new System.Windows.Rect : System.Windows.Size -> System.Windows.Rect
Public Sub New (size As Size)

매개 변수

size
Size

사각형의 너비와 높이를 지정하는 Size 구조체입니다.

예제

다음 예제에서는 새로 만드는 방법을 보여 줍니다 Rect 를 사용 하 여 구조를 Rect(Size) 생성자입니다.

private Rect createRectExample2()
{
    // This constructor initializes a new instance of the Rect structure that 
    // is of the specified size and is located at (0,0). 
    Rect myRectangle = new Rect(new Size(200, 50));

    // Returns a rectangle with a width of 200, a height of 50 and a position
    // of 0,0.
    return myRectangle;
}

적용 대상

Rect(Point, Point)

지정된 두 지점을 정확히 포함할 수 있는 크기의 Rect 구조체의 새 인스턴스를 초기화합니다.

public:
 Rect(System::Windows::Point point1, System::Windows::Point point2);
public Rect (System.Windows.Point point1, System.Windows.Point point2);
new System.Windows.Rect : System.Windows.Point * System.Windows.Point -> System.Windows.Rect
Public Sub New (point1 As Point, point2 As Point)

매개 변수

point1
Point

새 사각형에 들어 있어야 하는 첫 번째 지점입니다.

point2
Point

새 사각형에 들어 있어야 하는 두 번째 지점입니다.

예제

다음 예제에서는 새로 만드는 방법을 보여 줍니다 Rect 를 사용 하 여 구조를 Rect(Point, Point) 생성자입니다.

private Rect createRectExample3()
{
    // This constructor intializes a new instance of the Rect structure that is 
    // exactly large enough to contain the two specified points.  
    Rect myRectangle = new Rect(new Point(15, 30), new Point(50,70));

    // Returns a rectangle with a position of 15,30, a width of 35 and height of 40.
    return myRectangle;
}

적용 대상

Rect(Point, Size)

지정된 왼쪽 위 모퉁이 좌표 및 지정된 너비와 높이를 갖는 Rect 구조체의 새 인스턴스를 초기화합니다.

public:
 Rect(System::Windows::Point location, System::Windows::Size size);
public Rect (System.Windows.Point location, System.Windows.Size size);
new System.Windows.Rect : System.Windows.Point * System.Windows.Size -> System.Windows.Rect
Public Sub New (location As Point, size As Size)

매개 변수

location
Point

사각형의 왼쪽 위 모퉁이 위치를 지정하는 지점입니다.

size
Size

사각형의 너비와 높이를 지정하는 Size 구조체입니다.

예제

다음 예제에서는 새로 만드는 방법을 보여 줍니다 Rect 를 사용 하 여 구조를 Rect(Point, Size) 생성자입니다.

private Rect createRectExample4()
{
    // This constructor initializes a new instance of the Rect structure that has the 
    // specified top-left corner location and the specified width and height (Size).    
    Rect myRectangle = new Rect(new Point(15, 30), new Size(35, 40));

    // Returns a rectangle with a position of 15,30, a width of 35 and height of 40.
    return myRectangle;
}

적용 대상

Rect(Point, Vector)

지정된 지점 및 지정된 지점과 지정된 벡터의 합을 정확히 포함할 수 있는 크기의 Rect 구조체의 새 인스턴스를 초기화합니다.

public:
 Rect(System::Windows::Point point, System::Windows::Vector vector);
public Rect (System.Windows.Point point, System.Windows.Vector vector);
new System.Windows.Rect : System.Windows.Point * System.Windows.Vector -> System.Windows.Rect
Public Sub New (point As Point, vector As Vector)

매개 변수

point
Point

사각형에 들어 있어야 하는 지점입니다.

vector
Vector

지정된 지점에 대한 오프셋 거리입니다. 결과 사각형은 두 지점을 정확히 포함할 수 있는 크기입니다.

예제

다음 예제에서는 새로 만드는 방법을 보여 줍니다 Rect 를 사용 하 여 구조를 Rect(Point, Vector) 생성자입니다.

private Rect createRectExample5()
{
    // This constructor Intializes a new instance of the Rect structure that is exactly 
    // large enough to contain the specified point and the sum of the specified point 
    // and the specified vector.   
    Rect myRectangle = new Rect(new Point(15, 30), new Vector(35, 40));

    // Returns a rectangle with a position of 15,30, a width of 35 and height of 40.
    return myRectangle;
}

적용 대상

Rect(Double, Double, Double, Double)

지정된 x좌표, y좌표, 너비 및 높이를 갖는 Rect 구조체의 새 인스턴스를 초기화합니다.

public:
 Rect(double x, double y, double width, double height);
public Rect (double x, double y, double width, double height);
new System.Windows.Rect : double * double * double * double -> System.Windows.Rect
Public Sub New (x As Double, y As Double, width As Double, height As Double)

매개 변수

x
Double

사각형의 왼쪽 위 모퉁이의 X 좌표입니다.

y
Double

사각형의 왼쪽 위 모퉁이의 y 좌표입니다.

width
Double

사각형의 너비입니다.

height
Double

사각형의 높이입니다.

예외

width가 음의 값입니다.

또는 height가 음의 값입니다.

설명

다음 예제에서는 새로 만드는 방법을 보여 줍니다 Rect 를 사용 하 여 구조를 Rect(Double, Double, Double, Double) 생성자입니다.

private Rect createRectExample6()
{
    // This constructor intializes a new instance of the Rect structure with the specified 
    // x- and y-coordinates and the specified width and height. 
    Rect myRectangle = new Rect(15, 30, 35, 40);

    // Returns a rectangle with a position of 15,30, a width of 35 and height of 40.
    return myRectangle;
}

적용 대상