Overriding framework methods

I’m reading up on Overriding and Extends at the moment. Is there a way to Override a framework method, for example Graphics.DrawString so that my method is called across the whole app instead of the frameworks method?

e.g. in a Paint event, I get passed:

g As Graphics

So I call g.DrawString(…

But I’d like it to call my method instead so I can implement a few tweaks. I dont want to have to search/replace across the project and change all g.DrawString to g.DrawString2, I just want to drop in my new method and for it to work.

I’ve read up on Virtual Methods (Overriding) in http://developer.xojo.com/userguide/oop-design-concepts but that is using a Super which I cant do if I just want it as a drop in replacement.

I’ve got it working inside a Module using another Method name ie. DrawString2 using extends but I’d love to get it working as a drop in replacement make some tweaks to the functionality then call the actual DrawString to do the final render.

Any pointers? Thanks in advance.

Overriding is what you get when you create a subclass
But that doesn’t help you in these cases
And you cant override it in an extends method

Basically you cant override a framework method in the manner you’re trying to

What you can do is extend graphics so DrawString2 or whatever shows up as an option in autocomplete
But you will have to alter existing code to call that instead

Thanks Norman