graywolf
graywolf

Reputation: 7470

wxWidgets: Drawing over child

How can I draw over child of wxPanel? I'm using the classical way of drawing stuff,

class Foo : public wxPanel {
...
    void on_paint(wxEventPaint &) {
        wxPaintDC dc(this);
        ... // stuff with dc
    }
...
}

But the effect is that my stuff is painted and THAN the child is drawn over it. How can I do the reverse? Paint over the child?

I'm trying to achieve similar result:

What I want

So I have wxPanel with EVT_PAINT handler and wxStaticText as it's child. What I'm getting is

What I have

How can I paint after the child is drawn?

Or should I scrap the whole wxStaticText idea and just use DrawText? Are there any disadvantages to that approach? I'm using monospace font if it's relevant.

Upvotes: 0

Views: 275

Answers (1)

VZ.
VZ.

Reputation: 22678

Painting over native controls (or otherwise interfering with their drawing) is not supported by wxWidgets and never will be. You should draw the text yourself or use a (possibly modified version of) wxGenericStaticText which is implemented entirely in wxWidgets and so can be customized, unlike the native controls.

Upvotes: 1

Related Questions