Is it possible to draw transparent rectangle and text in wxPanel?
I have tried using wxPaintDc in which drawn rectangle not displayed on screen,
using wxScreenDc rectangle is dispalyed without transparency.
Code: Select all
void Panel::OnPaint(wxPaintEvent &evt)
{
wxPaintDC dc(this);
wxGraphicsContext* gdc1 = wxGraphicsContext::Create(dc);
wxGCDC gdc2;
gdc2.SetGraphicsContext(gdc1);
wxDC &gdc = static_cast<wxDC&>(gdc2);
PrepareDC(gdc);
int w, h;
GetSize(&w, &h);
gdc.SetPen(*wxTRANSPARENT_PEN);
gdc.SetBrush(*wxRED);
wxRect rec = GetClientRect();
gdc.DrawRoundedRectangle(rec, 20);
gdc.SetTextForeground(wxColour(*wxGREEN));
gdc.SetFont(wxFontInfo(10).Family(wxFONTFAMILY_MAX).Bold());
gdc.DrawText("designer panel drawText", 50, 50);
}
Thanks,
ranjani