Get a HiDPI disposable Graphics Context

This seems pretty basic, but I have forgotten how to do this.

I need to get a graphics context in order to calculate the position of a string to draw in a canvas. I do NOT want to do this in the canvas paint event. The whole idea is to calculate the X and Y in advance in order to speed up the drawing.

The string to draw is a property of a subclassed Object2D. The problem is, calculating X and Y in advance of drawing require a graphics context. As I’ve read, this is also important now because of HiDPI, to use the graphics object because the screen pixel density can be different than other visually equal width and height properties.

So the question is: how do I get a HiDPI disposable graphics context?

make a picture and use it’s graphics property.

this function: Page Not Found — Xojo documentation

Ah, thank you. That helps. I had read the Xojo blog post about this and then promptly forgot it!

Just for completeness sake, here are the blog entries:

and a German blog from Ulrich: