wxStaticText - transparent backgrounds in XP
BlitzMax Forums/Brucey's Modules/wxStaticText - transparent backgrounds in XP
| ||
In OS X wxStaticText labels automatically use a transparent background on textured panels, but this is not the case in XP. Searching the wxWidgets forum produced this answer ie, you override the erase background event and do your own drawing. Unfortunately, when I check wxEraseEvent, I find no GetDC() - just a commented out bit of code Rem bbdoc: Returns the device context associated with the erase event to draw on. End Rem ' Method GetDC:_wxDC() ' End Method What does this mean Brucey? You haven't implemented it, or we are meant to use another method? ta! David |
| ||
I've moved wxEraseEvent from wx to wxwindow, since it requires wxDC access. You should be able to catch wxEVT_ERASE_BACKGROUND events now, all being well, etc :-) |
| ||
Thanks Brucey :-) The event is being caught OK but I'm afraid I'm stuck for a solution. If anyone's interested in having a tinker - here's a little test bed with pretty much every solution I found online in it - none of which seem to work. Which, interestingly, is what each solution said of the others! Thanks, David |
| ||
Works on Mac! ;-) |
| ||
How's about this : Kind of avoids the issue by painting the appropriate bitmap section before drawing text on top of it. |
| ||
So EraseBackground wasn't needed in the end at all! I'm amazed at how many different solutions were out there - but I didn't see that one! Thanks so much Brucey :-) [Edit] I've cleaned up the above code and posted it below for the benefit of those also stuck on this issue. |
| ||
Thanks for this, working with a splash box so only need to extend the wxStaticText type. Now .Wrap() no longer works? and this example takes no notice of foreground text colour etc... Anyone feel like fixing it! |
| ||
Well the colour part should be easy:dc.SetTextForeground(GetForegroundColour()) The wrap might have to be done manually though. |