Looking for some clarification on the Rect documentation

From the Rect documentation:

LocalPoint(P As Point) As Point

Returns a new Point whose coordinates are local to the calling Rect.


LocalRect(P As Rect) As Rect

Returns a new Rect whose coordinates are local to the calling Rect.

What is local in this context? What is an example of what you would expect to be returned here?

Offset(DeltaX As Integer, DeltaY As Integer)

Moves the point the passed number of pixels. Positive numbers move the point down or to the right, negative move it up or to the left.

What point is being referred to here, the origin? Does this just basically move the entire rect in x,y direction?

Here’s an example for LocalPoint (and clearly it needs one so I’ll add it to the docs:

Var r As New Rect(100, 100, 200, 200)
Var p As New point(100, 100)
Var p1 As point = r.LocalPoint(p)

p1 is 0, 0.

Rect.OffSet moves the rectangle. So in the above example:

Var r As New Rect(100, 100, 200, 200)
r.OffSet(100, 100)

r is now 200, 200, 300, 300

Would that be 200, 200, 200, 200 or does it increase the width and height as well?

Sorry, yes it only updates x and y not width and height. I’ll fix the example in the docs.