Here's a slightly modified version.
Note how I subclassed a wxPanel, and have connected to the OnPaint event - this way I can do what I like when it needs to refresh itself.
I had made a more simple version, but it didn't look nice when the window was resized. This version (at least on Win32) appears to scale nicely, without flicker (it uses a double-buffered DC).
Is that what you're after?
' ' BlitzMax code generated with wxCodeGen v1.06 : 04 Aug 2008 23:19:04 ' ' ' PLEASE DO "NOT" EDIT THIS FILE! ' SuperStrict Framework wx.wxApp Import wx.wxFrame Import wx.wxPanel Import wx.wxStaticBitmap Import wx.wxWindow Import wx.wxAutoBufferedPaintDC New MyApp.run() Type MyApp Extends wxApp Field frame:MyFrame2Base Method OnInit:Int() ?macos ' make the default Mac font for controls not so big wxSystemOptions.SetOption(wxWINDOW_DEFAULT_VARIANT, wxWINDOW_VARIANT_SMALL) ? ' needed so my graphics show up wxInitAllImageHandlers() ' for Mac/Win32 (it is default on Linux) wxImage.AddHandler( New wxXPMHandler ) ' create the frame Local frame:MyFrame2Base = MyFrame2Base(New MyFrame2Base.Create(, , "C2D TaskList Manager")) ' frames are created hidden. You need to manually show it. frame.show() ' make sure it is brought to the front SetTopWindow(frame) Return True End Method End Type Type MyFrame2Base Extends wxFrame Field m_panel2:wxPanel Field m_bitmap3:wxStaticBitmap Method Create:MyFrame2Base(parent:wxWindow = Null,id:Int = wxID_ANY, title:String = "", x:Int = -1, y:Int = -1, w:Int = 624, h:Int = 513, style:Int = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL) Return MyFrame2Base(Super.Create(parent, id, title, x, y, w, h, style)) End Method Method OnInit() Local bSizer14:wxBoxSizer bSizer14 = New wxBoxSizer.Create(wxVERTICAL) m_panel2 = TGradientPanel(New TGradientPanel.Create(Self, wxID_ANY,,,,, wxTAB_TRAVERSAL)) bSizer14.Add(m_panel2, 1, wxEXPAND | wxALL, 0) SetSizer(bSizer14) Layout() End Method End Type Type TGradientPanel Extends wxPanel Field bitmap:wxBitmap Field image:wxImage Method OnInit() SetBackgroundStyle(wxBG_STYLE_CUSTOM) image = wxImage.CreateFromFile("C:/gradient.bmp", wxBITMAP_TYPE_ANY) DoSize() ConnectAny(wxEVT_PAINT, OnPaint) ConnectAny(wxEVT_SIZE, OnSize) End Method ' creates a new scaled bitmap to fit. Method DoSize() Local width:Int, height:Int GetSize(width, height) bitmap = wxBitmap.CreateFromImage(image.Scale(width, height)) End Method Function OnSize(event:wxEvent) Local panel:TGradientPanel = TGradientPanel(event.parent) panel.DoSize() panel.Refresh() End Function Function OnPaint(event:wxEvent) Local panel:TGradientPanel = TGradientPanel(event.parent) Local dc:wxAutoBufferedPaintDC = New wxAutoBufferedPaintDC.CreatePaintDC(panel) dc.DrawBitmap(panel.bitmap, 0, 0, False) dc.free() End Function End Type
Note how I subclassed a wxPanel, and have connected to the OnPaint event - this way I can do what I like when it needs to refresh itself.
I had made a more simple version, but it didn't look nice when the window was resized. This version (at least on Win32) appears to scale nicely, without flicker (it uses a double-buffered DC).
Is that what you're after?