言語

Rect.Inflate メソッド

定義

指定した量だけ四角形を展開または縮小した結果の四角形を作成します。

オーバーロード

名前 説明
Inflate(Size)

指定した Sizeを使用して四角形をすべての方向に展開します。

Inflate(Double, Double)

指定した幅と高さの量を使用して四角形をすべての方向に展開または縮小します。

Inflate(Rect, Size)

指定した四角形を、指定した Sizeによってすべての方向に展開した結果として得られた四角形を返します。

Inflate(Rect, Double, Double)

指定した四角形を、指定した幅と高さの量だけすべての方向に拡大または縮小した結果の四角形を作成します。

Inflate(Size)

指定した Sizeを使用して四角形をすべての方向に展開します。

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)

パラメーター

size
Size

四角形を展開する量を指定します。 Size構造体の Width プロパティは、四角形のLeftプロパティとRightプロパティを増やす量を指定します。 Size構造体の Height プロパティは、四角形のTopプロパティとBottomプロパティを増やす量を指定します。

例外

このメソッドは、 Empty 四角形で呼び出されます。

次の例は、 Inflate(Size) メソッドを使用して四角形のサイズを大きくする方法を示しています。

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

注釈

結果として得られる四角形のWidthは、指定したWidth構造体のSizeの 2 倍に増加します。これは、四角形の左右の両方が拡大されるためです。 同様に、結果として得られる四角形のHeightは、指定したHeight構造体のSizeの 2 倍増加します。

こちらもご覧ください

適用対象

Inflate(Double, Double)

指定した幅と高さの量を使用して四角形をすべての方向に展開または縮小します。

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)

パラメーター

width
Double

四角形の左右の辺を拡大または縮小する量。

height
Double

四角形の上下の辺を拡大または縮小する量。

例外

このメソッドは、 Empty 四角形で呼び出されます。

次の例は、 Inflate(Double, Double) メソッドを使用して四角形のサイズを変更する方法を示しています。

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

注釈

結果として得られる四角形の Width は、四角形の左右の両方に適用されるため、指定した幅オフセットの 2 倍だけ増減されます。 同様に、結果として得られる四角形の Height は、指定した高さの 2 倍だけ増減されます。

指定した幅または高さが、現在の Width または Height を超えて四角形を縮小した場合、四角形は Empty の四角形になります。

こちらもご覧ください

適用対象

Inflate(Rect, Size)

指定した四角形を、指定した Sizeによってすべての方向に展開した結果として得られた四角形を返します。

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

パラメーター

rect
Rect

変更する Rect 構造体。

size
Size

四角形を展開する量を指定します。 Size構造体の Width プロパティは、四角形のLeftプロパティとRightプロパティを増やす量を指定します。 Size構造体の Height プロパティは、四角形のTopプロパティとBottomプロパティを増やす量を指定します。

返品

結果の四角形。

例外

rectEmpty 四角形です。

次の例は、 Inflate(Rect, Size) メソッドを使用して四角形のサイズを変更する方法を示しています。

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

注釈

結果として得られる四角形のWidthは、指定したWidth構造体のSizeの 2 倍に増加します。これは、四角形の左右の両方が拡大されるためです。 同様に、結果として得られる四角形のHeightは、指定したHeight構造体のSizeの 2 倍増加します。

こちらもご覧ください

適用対象

Inflate(Rect, Double, Double)

指定した四角形を、指定した幅と高さの量だけすべての方向に拡大または縮小した結果の四角形を作成します。

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

パラメーター

rect
Rect

変更する Rect 構造体。

width
Double

四角形の左右の辺を拡大または縮小する量。

height
Double

四角形の上下の辺を拡大または縮小する量。

返品

結果の四角形。

例外

rectEmpty 四角形です。

次の例は、 Inflate(Rect, Double, Double) メソッドを使用して四角形のサイズを変更する方法を示しています。

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

注釈

結果として得られる四角形の Width は、四角形の左右の両方に適用されるため、指定した幅オフセットの 2 倍だけ増減されます。 同様に、結果として得られる四角形の Height は、指定した高さの 2 倍だけ増減されます。

指定した幅または高さの修飾子が、現在の Width または Height を超えて四角形を縮小した場合、このメソッドは Rect.Emptyを返します。

こちらもご覧ください

適用対象