PointF.Subtract Method

Definition

Translates a PointF by the negative of a specified size.

Overloads

Subtract(PointF, Size)

Translates a PointF by the negative of a specified size.

Subtract(PointF, SizeF)

Translates a PointF by the negative of a specified size.

Subtract(PointF, Size)

Source:
PointF.cs
Source:
PointF.cs
Source:
PointF.cs

Translates a PointF by the negative of a specified size.

C#
public static System.Drawing.PointF Subtract(System.Drawing.PointF pt, System.Drawing.Size sz);

Parameters

pt
PointF

The PointF to translate.

sz
Size

The Size that specifies the numbers to subtract from the coordinates of pt.

Returns

The translated PointF.

Remarks

The Subtract method subtracts the Width of the specified size from the x-coordinate of the PointF and the Height from the y-coordinate of the PointF.

See also

Applies to

.NET 10 and other versions
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

Subtract(PointF, SizeF)

Source:
PointF.cs
Source:
PointF.cs
Source:
PointF.cs

Translates a PointF by the negative of a specified size.

C#
public static System.Drawing.PointF Subtract(System.Drawing.PointF pt, System.Drawing.SizeF sz);

Parameters

pt
PointF

The PointF to translate.

sz
SizeF

The SizeF that specifies the numbers to subtract from the coordinates of pt.

Returns

The translated PointF.

Examples

The following code example demonstrates how to use the Subtract operator. To run this example, paste the following code into a Windows Form. Handle the form's Paint event and call SubtractExample, passing e as PaintEventArgs.

C#
private void SubtractExample(PaintEventArgs e)
{
    PointF point1 = new PointF(120.5F, 120F);
    SizeF size1 = new SizeF(120.5F, 30.5F);
    PointF point2 = PointF.Subtract(point1, size1);
    e.Graphics.DrawLine(Pens.Blue, point1, point2);
}

Remarks

The Subtract method subtracts the Width of the specified size from the x-coordinate of the PointF and the Height from the y-coordinate of the PointF.

See also

Applies to

.NET 10 and other versions
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