Problema sull'oggetto Graphics (in passaggio da 2013r3 a2018r3

Salve di nuovo
ho riscontrato un altro problema nel passaggio alla 2018r3
mi da questo errore:

WindowBase.PushButton1.Action, line 37
Static reference to instance method: call this on an instance of class Graphics.
Lungo= Graphics.StringWidth(Rs.field(“IDCONTEGGIO”))

2018 again.
This deprecation is annoying.

Try:

dim p as new picture (10,10) Lungo= p.Graphics.StringWidth(Rs.field("IDCONTEGGIO"))

funziona!