If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
void wxImagePanel::OnPaintEvent(wxPaintEvent& evt)
{
// depending on your system you may need to look at double-buffered dcs
wxPaintDC dc(this);
RenderImage(dc);
}
void wxImagePanel::RenderImage(wxDC& dc)
{
if (image)
{
dc.SetUserScale((double)GetSize().x / (double)image->GetWidth(), (double)GetSize().y / (double)image->GetHeight());
dc.DrawBitmap(*image, 0, 0, false);
}
}
Drawing glitches appearing when the window is resized are often fixed by creating the window (wxImagePanel here) with wxFULL_REPAINT_ON_RESIZE flag.
Your drawing code should probably also account for possibility of image being null. If you do not call SetBackgroundStyle(wxBG_STYLE_PAINT) for your window and relying on the background erase, you should change that to avoid possible flicker. This makes you responsible for drawing the panel background, so you should do something when the bitmap is not available (e.g., calling wxDC::Clear()).