The reason I wanted to do this is that I am reverse engineering a file structure and painting it to a canvas. As I do this, and the file structure evolves in the future, I am bound to come across file elements that I haven’t handled and I’m using message boxes to flag when the app finds such a file element.
Yes, message boxes are not the right way to debug but this isn’t just debugging because it may be users who find these unhandled elements and they cannot me expected to check system console output. They need an “in their face” message to contact me so I can deal with it.
Yes, I could validate and prepare all data before it reaches the paint event, and that’s probably the best way to do it. However, this isn’t a commercial app, it’s just something I’m knocking together quickly as a freebie for anyone interested so I was hoping to not have to do all of that extra work.