'__ the idea of this demo is trying to move the red square around horizontally '__ from slider value 'old program, changed by Dirk Noack 2014 frame = new wxFrame(nothing, -1, "wxMemoryDC test", wxPoint(0, 0), wxSize(220, 95), wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX) frame.Centre() slider1 = new wxSlider(frame, -1, 0, 0, 48, wxPoint(72, 8), wxSize(140, 20)) '__ if you set remarked the line below, wxMemoryDC is not displayed - why? gauge1 = new wxGauge(frame, -1, 100, wxPoint(160, 290), wxSize(15, 15), wxGA_SMOOTH) '__ another question: how can i set RGB colours beyond primaries, like #0F356A ? const pen01 = wxPenFromColorName("green", 1, wxSOLID) const brush01 = wxBrushFromColorName("blue", wxSOLID) const brush02 = wxBrushFromColorName("red", wxSOLID) dim bmp = wxEmptyBitmap(256, 256) dim bmpDC = wxMemoryDC() bmpDC.SelectObject(bmp) bmpDC.SetBackground(brush01) bmpDC.SetPen(pen01) bmpDC.Clear() bmpDC.SetBrush(brush02) bmpDC.DrawRoundedRectangle(2, 16, 16, 16, 2) atValue = 0 sub SliderToSquarePosControl(event) atValue = slider1.GetValue() frame.Refresh( FALSE ) end sub connect(slider1, wxEVT_COMMAND_SLIDER_UPDATED, "SliderToSquarePosControl") sub OnPaint( event ) ' erase the old drawing bmpDC.Clear() ' draw a rectangle bmpDC.DrawRoundedRectangle(slider1.GetValue(), 16, 16, 16, 2) ' update the window dim dc = wxPaintDC(frame) dc.Blit(4, 4, 64, 64, bmpDC, 0, 0) end sub connect(frame, -1, wxEVT_PAINT, "onPaint" ) frame.Show(TRUE)