Size.Add(Size, Size) メソッド


ある Size 構造体の幅と高さを別の Size 構造体の幅と高さに加算します。Adds the width and height of one Size structure to the width and height of another Size structure.

 static System::Drawing::Size Add(System::Drawing::Size sz1, System::Drawing::Size sz2);
public static System.Drawing.Size Add (System.Drawing.Size sz1, System.Drawing.Size sz2);
static member Add : System.Drawing.Size * System.Drawing.Size -> System.Drawing.Size
Public Shared Function Add (sz1 As Size, sz2 As Size) As Size



最初に加算する Size 構造体。The first Size structure to add.


加算対象の 2 番目の Size 構造体。The second Size structure to add.


加算演算の結果を表す Size 構造体。A Size structure that is the result of the addition operation.

次のコード例は、Add メソッドの使用方法を示します。The following code example demonstrates how to use the Add method. この例を実行するには、Windows フォームに貼り付けます。To run this example, paste it into a Windows Form. フォームの Paint イベントを処理し、Paint イベント処理メソッドから AddSizes メソッドを呼び出して、ePaintEventArgsとして渡します。Handle the form's Paint event and call the AddSizes method from the Paint event-handling method, passing e as PaintEventArgs.

private void AddSizes(PaintEventArgs e)
    Size size1 = new Size(100, 100);
    Size size2 = new Size(50,50);
    e.Graphics.DrawRectangle(Pens.Black, new Rectangle(new Point(10,10), size1));
    size1 = Size.Add(size1, size2);
    e.Graphics.DrawRectangle(Pens.Red, new Rectangle(new Point(10, 10), size1));
Private Sub AddSizes(ByVal e As PaintEventArgs) 
    Dim size1 As New Size(100, 100)
    Dim size2 As New Size(50, 50)
    e.Graphics.DrawRectangle(Pens.Black, New Rectangle(New Point(10, 10), size1))
    size1 = System.Drawing.Size.Add(size1, size2)
    e.Graphics.DrawRectangle(Pens.Red, New Rectangle(New Point(10, 10), size1))

End Sub