IRONSOFTWAREHOME
Offset
using IronSoftware.Drawing;
using System;

PointF pointFloat = new PointF(22.2f, 25.7f);

// Offset method adds offset value to the original point.
pointFloat.Offset(-10, 10);

// Check new x coordinate value after offset
Console.WriteLine(pointFloat.X);

// Check new y coordinate value after offset
Console.WriteLine(pointFloat.Y);
NuGet Download
PM > Install-Package IronSoftware.System.Drawing
Offset

Offset

This example should guide you on how to adjust coordinates in the PointF or Point class using the Offset() method.

This method is available in both the Point and PointF classes, and it is mainly used to programmatically move or adjust the coordinates of a certain point. The Offset() method modifies the current x and y coordinates of a point without returning a new Point object.

To use the Offset() method, simply call it with two integer values as arguments on a Point or PointF object. The first argument will offset the point's x coordinate, while the second argument will offset the point's y-coordinate. This method also accepts negative values as arguments.

  • Instantiating a PointF object: The PointF class is used to represent points with floating-point numbers for x and y coordinates. In this example, the point is initialized at (10.5, 20.5).
  • Calling the Offset() method: The method adjusts the coordinates of the PointF object by the specified offset values. Specifically, point.Offset(-5.0f, 10.0f); will move the point's x coordinate by -5.0 and its y coordinate by +10.0.
  • Console output: The initial and new coordinates of the PointF object are printed to the console, demonstrating the effect of the Offset() method.
View on GitHub

Ready to Get Started?

Nuget Downloads 19,926,787Version:2025.3just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required