From Xojo Documentation


Graphics.Translate(translateX As Double, translateY As Double)

New in 2020r2

Supported for all project types and targets.

Translates the origin point by the specified translateX and translateY values. Useful with Rotate.


Support for Translate in Desktop and Console applications was added in 2021r1.

Sample Code

From within an MobileCanvas.Paint event handler:

// Rotate square in center of graphics area
Const Pi = 3.14159
g.Translate(g.Width / 2, g.Height / 2)
g.Rotate(Pi / 4) // 45 degrees or 1/8 of a circle
g.DrawingColor = Color.Blue
g.FillRectangle(10, 10, 50, 50)