I'm trying to create a custom transparent wxTextCtrl
by driving from it and drawing the text myself as follow:
BEGIN_EVENT_TABLE(TextLayer, wxTextCtrl)
EVT_PAINT(TextLayer::OnPaint)
EVT_ERASE_BACKGROUND(TextLayer::OnEraseBackground)
END_EVENT_TABLE()
void TextLayer::OnEraseBackground(wxEraseEvent& event) {}
void TextLayer::OnPaint(wxPaintEvent & evt)
{
wxAutoBufferedPaintDC dc(this);
PrepareDC(dc);
wxGraphicsContext *gc = wxGraphicsContext::Create( dc );
if(gc)
{
dc.SetFont(GetFont());
dc.SetTextForeground(GetForegroundColour());
auto a = GetValue();
dc.DrawText(GetValue(), 0, 0);
delete gc;
}
}
but it's not working , it's not transparent , how I'm supposed to do it correctly?
Aucun commentaire:
Enregistrer un commentaire