Edit

Share via


Point.Add(Point, Size) Method

Definition

Adds the specified Size to the specified Point.

C#
public static System.Drawing.Point Add(System.Drawing.Point pt, System.Drawing.Size sz);

Parameters

pt
Point

The Point to add.

sz
Size

The Size to add.

Returns

The Point that is the result of the addition operation.

Examples

The following example shows 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 AddPoint method from the Paint event-handling method, passing e as PaintEventArgs.

C#
private void AddPoint(PaintEventArgs e)
{
    Point point1 = new Point(10, 10);
    Point point2 = Point.Add(point1, new Size(250,0));
    e.Graphics.DrawLine(Pens.Red, point1, point2);
}

Remarks

The Add adds the Width and Height of the specified Size to the X and Y values of the specified point.

Applies to

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1