Språk

Rect.Inflate Metod

Definition

Skapar en rektangel som resulterar i att en rektangel expanderas eller krymps med den angivna mängden.

Överlagringar

Name Description
Inflate(Size)

Expanderar rektangeln med hjälp av den angivna Size, i alla riktningar.

Inflate(Double, Double)

Expanderar eller krymper rektangeln med hjälp av angivna bredd- och höjdmängder i alla riktningar.

Inflate(Rect, Size)

Returnerar den rektangel som resulterar i att den angivna rektangeln expanderas av den angivna Size, i alla riktningar.

Inflate(Rect, Double, Double)

Skapar en rektangel som resulterar i att den angivna rektangeln expanderas eller krymps med angivna bredd- och höjdbelopp i alla riktningar.

Inflate(Size)

Expanderar rektangeln med hjälp av den angivna Size, i alla riktningar.

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)

Parametrar

size
Size

Anger hur mycket rektangeln ska expanderas. Strukturens SizeWidth egenskap anger hur mycket rektangeln och Left egenskaperna ska ökasRight. Strukturens SizeHeight egenskap anger hur mycket rektangeln och Top egenskaperna ska ökasBottom.

Undantag

Den här metoden anropas på Empty rektangeln.

Exempel

I följande exempel visas hur du använder Inflate(Size) metoden för att öka storleken på en rektangel.

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;
}

Kommentarer

Den Width resulterande rektangeln ökas dubbelt så mycket som Width den angivna Size strukturen, eftersom både vänster och höger sida av rektangeln är uppblåsta. Height På samma sätt ökas rektangelns resulterande rektangel med dubbelt så mycket som den Height angivna Size strukturen.

Se även

Gäller för

Inflate(Double, Double)

Expanderar eller krymper rektangeln med hjälp av angivna bredd- och höjdmängder i alla riktningar.

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)

Parametrar

width
Double

Mängden som rektangelns vänster- och högersidor ska expanderas eller krympas med.

height
Double

Mängden som rektangelns övre och nedre sidor ska expanderas eller krympas med.

Undantag

Den här metoden anropas på Empty rektangeln.

Exempel

I följande exempel visas hur du använder Inflate(Double, Double) metoden för att ändra storleken på en rektangel.

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;
}

Kommentarer

Rektangelns Width resulterande rektangel ökas eller minskas med två gånger den angivna breddförskjutningen, eftersom den tillämpas på både vänster och höger sida av rektangeln. Height På samma sätt ökas eller minskas rektangelns resulterande rektangel med två gånger den angivna höjden.

Om den angivna bredden eller höjden krymper rektangeln med mer än dess ström Width eller Height - vilket ger rektangeln ett negativt område - blir Empty rektangeln rektangeln.

Se även

Gäller för

Inflate(Rect, Size)

Returnerar den rektangel som resulterar i att den angivna rektangeln expanderas av den angivna Size, i alla riktningar.

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

Parametrar

rect
Rect

Den struktur som Rect ska ändras.

size
Size

Anger hur mycket rektangeln ska expanderas. Strukturens SizeWidth egenskap anger hur mycket rektangeln och Left egenskaperna ska ökasRight. Strukturens SizeHeight egenskap anger hur mycket rektangeln och Top egenskaperna ska ökasBottom.

Returer

Den resulterande rektangeln.

Undantag

rect är en Empty rektangel.

Exempel

I följande exempel visas hur du använder Inflate(Rect, Size) metoden för att ändra storleken på en rektangel.

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;
}

Kommentarer

Den Width resulterande rektangeln ökas dubbelt så mycket som Width den angivna Size strukturen, eftersom både vänster och höger sida av rektangeln är uppblåsta. Height På samma sätt ökas rektangelns resulterande rektangel med dubbelt så mycket som den Height angivna Size strukturen.

Se även

Gäller för

Inflate(Rect, Double, Double)

Skapar en rektangel som resulterar i att den angivna rektangeln expanderas eller krymps med angivna bredd- och höjdbelopp i alla riktningar.

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

Parametrar

rect
Rect

Den struktur som Rect ska ändras.

width
Double

Mängden som rektangelns vänster- och högersidor ska expanderas eller krympas med.

height
Double

Mängden som rektangelns övre och nedre sidor ska expanderas eller krympas med.

Returer

Den resulterande rektangeln.

Undantag

rect är en Empty rektangel.

Exempel

I följande exempel visas hur du använder Inflate(Rect, Double, Double) metoden för att ändra storleken på en rektangel.

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;
}

Kommentarer

Rektangelns Width resulterande rektangel ökas eller minskas med två gånger den angivna breddförskjutningen, eftersom den tillämpas på både vänster och höger sida av rektangeln. Height På samma sätt ökas eller minskas rektangelns resulterande rektangel med två gånger den angivna höjden.

Om den angivna bredden eller höjdmodifierarna krymper rektangeln med mer än dess nuvarande Width eller Height - vilket ger rektangeln ett negativt område - returnerar Rect.Emptyden här metoden .

Se även

Gäller för