Namespace: System.Drawing
Assembly: System.Drawing (in System.Drawing.dll)
Assembly: System.Drawing (in System.Drawing.dll)
Syntax . . :: . Size
A Size structure that is the result of the addition operation.
Public Shared Function Add ( _
sz1 As Size, _
sz2 As Size _
) As Sizepublic static Size Add(
Size sz1,
Size sz2
)public:
static Size Add(
Size sz1,
Size sz2
)static member Add :
sz1:Size *
sz2:Size -> Size
Parameters
- sz1
- Type: System.Drawing
. . :: . Size
The first Size structure to add.
- sz2
- Type: System.Drawing
. . :: . Size
The second Size structure to add.
Return Value
Type: System.DrawingA Size structure that is the result of the addition operation.
Examples
The following code example demonstrates how to use the Add method. To run this example, paste it into a Windows Form. Handle the form’s Paint event and call the AddSizes method from the Paint event-handling method, passing e as PaintEventArgs.
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
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));
}
Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.