Perfect Method Candidate inside Paint Event ... What to Do?

I have what would be an ideal method but the code is inside a paint event on a canvas control and uses several graphic features that make moving it to a standard method impossible (that I know of). What do other users do i these cases, create subroutines in the paint event and call them multiple times? Are there features I don’t know about (very possible) that are designed to handle this? If so how do thy work? Any example programs? Thanks in advance.

What’s the problem? You just need to pass g around. Let me check my code. Here is something that is even a class:

[code]Sub Constructor(hasGraphics as Graphics, hasText as String, hasStyle as integer = 1, hasTextFont as String = “LucidaGrande”, hasTextSize as integer = 11, hasBaseOffsetX as integer = 0, hasBaseOffsetY as integer = 0, HasIsHeader as boolean = false)

'draws either black text with a white background or white text with a small drop shadow
'is not a canvas so that it can be passed to other drawing classes

'set all properties for drawing

text = hasText
Style = hasStyle
if hasTextFont = “” then
TextFont = OSUtils.getAppearanceFont(true)
TextFont = hasTextFont
end if
if hasTextSize = 0 then
TextSize = NSFontMBS.smallSystemFontSize
TextSize = hasTextSize
end if
WrapWidth = 30000
theGraphics = hasGraphics
BaseOffsetX = hasBaseOffsetX
BaseOffsetY = hasBaseOffsetY
IsHeader = HasIsHeader

'draw something here
End Sub

which is called in a paint event:

dim theEmboss as new clsTextEmboss(g, Uppercase(Text), 2, TextFont, TextSize , 0, 0, true)

If you be so kind to show what you have so far, it will be easy to show you how to move the method out of the control paint event to be able to use it on any other canvas.

All graphics features are available anywhere in a Xojo app. Which one do you believe cannot be used outside ?

Where does one store files to make them available for FTP downloads like to share them here on the forum?

your own website, a GitHub account, or one of many other file sharing services