CustomBitmap *bitmapCtrl1 = new CustomBitmap(mainPanel, bitmap1, id+1, rollover_bitmap1, NULL, wxDefaultPosition, wxSize(125, 125));
CustomBitmap
类派生自wxControl
. 这是我的 OnPaint 函数。
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
}