Rect.Inflate Metoda

Definicja

Tworzy prostokąt, który wynika z rozszerzania lub zmniejszania prostokąta o określoną kwotę.

Przeciążenia

Inflate(Size)

Rozszerza prostokąt przy użyciu określonego Sizeelementu , we wszystkich kierunkach.

Inflate(Double, Double)

Rozszerza lub zmniejsza prostokąt przy użyciu określonej szerokości i wysokości we wszystkich kierunkach.

Inflate(Rect, Size)

Zwraca prostokąt, który wynika z rozszerzenia określonego prostokąta przez określony Sizeelement , we wszystkich kierunkach.

Inflate(Rect, Double, Double)

Tworzy prostokąt, który wynika z rozszerzania lub zmniejszania określonego prostokąta według określonej szerokości i wysokości we wszystkich kierunkach.

Inflate(Size)

Rozszerza prostokąt przy użyciu określonego Sizeelementu , we wszystkich kierunkach.

public:
 void Inflate(System::Windows::Size size);
public void Inflate (System.Windows.Size size);
member this.Inflate : System.Windows.Size -> unit
Public Sub Inflate (size As Size)

Parametry

size
Size

Określa ilość do rozwinięcia prostokąta. Właściwość Size struktury Width określa kwotę, aby zwiększyć właściwości i Right prostokątaLeft. Właściwość Size struktury Height określa kwotę, aby zwiększyć właściwości i Bottom prostokątaTop.

Wyjątki

Ta metoda jest wywoływana na prostokątze Empty .

Przykłady

W poniższym przykładzie pokazano, jak za pomocą Inflate(Size) metody zwiększyć rozmiar prostokąta.

private Size inflateExample1()
{
    // Initialize new rectangle.
    Rect myRectangle = new Rect();

    // The Location property specifies the coordinates of the upper left-hand 
    // corner of the rectangle. 
    myRectangle.Location = new Point(10, 5);

    // Set the Size property of the rectangle with a width of 200
    // and a height of 50.
    myRectangle.Size = new Size(200, 50);

    // Use the Inflate method to expand the rectangle by the specified Size in all
    // directions. The new size is 240,110. Note: Width of the resulting rectangle  
    // is increased by twice the Width of the specified Size structure because  
    // both the left and right sides of the rectangle are inflated. Likewise, the 
    // Height of the resulting rectangle is increased by twice the Height of the 
    // specified Size structure.
    myRectangle.Inflate(new Size(20,30));

    return myRectangle.Size;
}

Uwagi

Wynikowy Width prostokąt jest zwiększany o dwa razy Width więcej niż określona Size struktura, ponieważ obie lewe i prawe boki prostokąta są zawyżone. Podobnie wynikowy Height prostokąt jest zwiększany o dwa razy więcej niż Height określona Size struktura.

Zobacz też

Dotyczy

Inflate(Double, Double)

Rozszerza lub zmniejsza prostokąt przy użyciu określonej szerokości i wysokości we wszystkich kierunkach.

public:
 void Inflate(double width, double height);
public void Inflate (double width, double height);
member this.Inflate : double * double -> unit
Public Sub Inflate (width As Double, height As Double)

Parametry

width
Double

Ilość, o którą chcesz rozwinąć lub zmniejszyć lewą i prawą stronę prostokąta.

height
Double

Ilość, o którą chcesz rozwinąć lub zmniejszyć górną i dolną stronę prostokąta.

Wyjątki

Ta metoda jest wywoływana na prostokątze Empty .

Przykłady

W poniższym przykładzie pokazano, jak za pomocą Inflate(Double, Double) metody zmienić rozmiar prostokąta.

private Size inflateExample2()
{
    // Initialize new rectangle.
    Rect myRectangle = new Rect();

    // The Location property specifies the coordinates of the upper left-hand 
    // corner of the rectangle. 
    myRectangle.Location = new Point(10, 5);

    // Set the Size property of the rectangle with a width of 200
    // and a height of 50.
    myRectangle.Size = new Size(200,50);

    // Use the Inflate method to expand or shrink the rectangle by the specified 
    // width and height amounts. The new size is 160,150 (width shrunk by 40 and  
    // height increased by 100). Note: Width of the resulting rectangle is increased 
    // or shrunk by twice the specified width, because both the left and right sides  
    // of the rectangle are inflated or shrunk. Likewise, the height of the resulting 
    // rectangle is increased or shrunk by twice the specified height.
    myRectangle.Inflate(-20,50);

    return myRectangle.Size;
}

Uwagi

Wynikowy Width prostokąt jest zwiększany lub zmniejszany o dwa razy większe niż przesunięcie określonej szerokości, ponieważ jest stosowany zarówno po lewej, jak i prawej stronie prostokąta. Podobnie wynikowy Height prostokąt jest zwiększany lub zmniejszany o dwukrotnie określoną wysokość.

Jeśli określona szerokość lub wysokość zmniejsza prostokąt o więcej niż jego bieżący Width lub Height — dając prostokątowi ujemny obszar — prostokąt staje się prostokątem Empty .

Zobacz też

Dotyczy

Inflate(Rect, Size)

Zwraca prostokąt, który wynika z rozszerzenia określonego prostokąta przez określony Sizeelement , we wszystkich kierunkach.

public:
 static System::Windows::Rect Inflate(System::Windows::Rect rect, System::Windows::Size size);
public static System.Windows.Rect Inflate (System.Windows.Rect rect, System.Windows.Size size);
static member Inflate : System.Windows.Rect * System.Windows.Size -> System.Windows.Rect
Public Shared Function Inflate (rect As Rect, size As Size) As Rect

Parametry

rect
Rect

Struktura Rect do modyfikacji.

size
Size

Określa ilość do rozwinięcia prostokąta. Właściwość Size struktury Width określa kwotę, aby zwiększyć właściwości i Right prostokątaLeft. Właściwość Size struktury Height określa kwotę, aby zwiększyć właściwości i Bottom prostokątaTop.

Zwraca

Rect

Wynikowy prostokąt.

Wyjątki

rect jest prostokątem Empty .

Przykłady

W poniższym przykładzie pokazano, jak za pomocą Inflate(Rect, Size) metody zmienić rozmiar prostokąta.

private Size inflateExample3()
{
    // Initialize new rectangle.
    Rect myRectangle = new Rect();

    // The Location property specifies the coordinates of the upper left-hand 
    // corner of the rectangle. 
    myRectangle.Location = new Point(10, 5);

    // Set the Size property of the rectangle with a width of 200
    // and a height of 50.
    myRectangle.Size = new Size(200, 50);

    // Use the static Inflate method to return an expanded version of myRectangle1.   
    // The size of myRectangle2 is 240,110. Note: Width of the resulting rectangle is increased 
    // by twice the Width of the specified Size structure, because both the left and right 
    // sides of the rectangle are inflated. Likewise, the Height of the resulting 
    // rectangle is increased by twice the Height of the specified Size structure.
    Rect myRectangle2 = Rect.Inflate(myRectangle, new Size(20, 30));

    return myRectangle2.Size;
}

Uwagi

Wynikowy Width prostokąt jest zwiększany o dwa razy Width więcej niż określona Size struktura, ponieważ obie lewe i prawe boki prostokąta są zawyżone. Podobnie wynikowy Height prostokąt jest zwiększany o dwa razy więcej niż Height określona Size struktura.

Zobacz też

Dotyczy

Inflate(Rect, Double, Double)

Tworzy prostokąt, który wynika z rozszerzania lub zmniejszania określonego prostokąta według określonej szerokości i wysokości we wszystkich kierunkach.

public:
 static System::Windows::Rect Inflate(System::Windows::Rect rect, double width, double height);
public static System.Windows.Rect Inflate (System.Windows.Rect rect, double width, double height);
static member Inflate : System.Windows.Rect * double * double -> System.Windows.Rect
Public Shared Function Inflate (rect As Rect, width As Double, height As Double) As Rect

Parametry

rect
Rect

Struktura Rect do modyfikacji.

width
Double

Ilość, o którą chcesz rozwinąć lub zmniejszyć lewą i prawą stronę prostokąta.

height
Double

Ilość, o którą chcesz rozwinąć lub zmniejszyć górną i dolną stronę prostokąta.

Zwraca

Rect

Wynikowy prostokąt.

Wyjątki

rect jest prostokątem Empty .

Przykłady

W poniższym przykładzie pokazano, jak za pomocą Inflate(Rect, Double, Double) metody zmienić rozmiar prostokąta.

private Size inflateExample4()
{
    // Initialize new rectangle.
    Rect myRectangle = new Rect();

    // The Location property specifies the coordinates of the upper left-hand 
    // corner of the rectangle. 
    myRectangle.Location = new Point(10, 5);

    // Set the Size property of the rectangle with a width of 200
    // and a height of 50.
    myRectangle.Size = new Size(200, 50);

    // Use the static Inflate method to return a version of myRectangle with a shrunk
    // width and expanded height. The size of myRectangle2 is 160,150. Note: Width of the resulting 
    // rectangle is increased or shrunk by twice the specified width, because both the
    // left and right sides of the rectangle are inflated or shrunk. Likewise, the height 
    // of the resulting rectangle is increased or shrunk by twice the specified height.
    Rect myRectangle2 = Rect.Inflate(myRectangle, -20, 50);

    return myRectangle2.Size;
}

Uwagi

Wynikowy Width prostokąt jest zwiększany lub zmniejszany o dwa razy większe niż przesunięcie określonej szerokości, ponieważ jest stosowany zarówno po lewej, jak i prawej stronie prostokąta. Podobnie wynikowy Height prostokąt jest zwiększany lub zmniejszany o dwukrotnie określoną wysokość.

Jeśli określona szerokość lub modyfikatory wysokości zmniejszają prostokąt o więcej niż jego bieżący Width lub Height — dając prostokątowi ujemny obszar — ta metoda zwraca Rect.Emptywartość .

Zobacz też

Dotyczy