+void MyFrame::OnToolbarCustomBg(wxCommandEvent& event)
+{
+ wxToolBarBase *tb = GetToolBar();
+
+ if ( event.IsChecked() )
+ {
+ tb->Connect
+ (
+ wxEVT_ERASE_BACKGROUND,
+ wxEraseEventHandler(MyFrame::OnEraseToolBarBackground),
+ NULL,
+ this
+ );
+ }
+ else
+ {
+ tb->Disconnect
+ (
+ wxEVT_ERASE_BACKGROUND,
+ wxEraseEventHandler(MyFrame::OnEraseToolBarBackground),
+ NULL,
+ this
+ );
+ }
+
+ tb->Refresh();
+}
+