CustomBitmap *bitmapCtrl1 = new CustomBitmap(mainPanel, bitmap1, id+1, rollover_bitmap1, NULL, wxDefaultPosition, wxSize(125, 125));
CustomBitmap
class is derived from wxControl
. And this is my OnPaint function.
void CustomBitmap::OnPaint(wxPaintEvent& WXUNUSED(event))
{
wxPaintDC dc((wxWindow *) this);
SetTransparent(0);
if (m_enter)
{
dc.DrawBitmap(m_bmpmouseover, 0, 0, true);
}
else
{
if (m_leftdown || m_rightdown){
dc.DrawBitmap(m_bmpclick, 0, 0, true);
}
else {
dc.DrawBitmap(m_bmpstatic, 0, 0, true);
}
}
#ifdef WX3
//dc.EndDrawing();
#else
// dc.EndDrawing();
#endif
}
Generally speaking, you can't customize drawing of the native controls, they just are not made to cooperate with you. If you need round buttons, you will have to draw them and also handle input and generate events for them entirely yourself.
You may find wxRendererNative
and wxMouseEventsManager
helpful for drawing and input handling respectively.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.