This tutorial makes a simple
wxWidgets program to edit XPM format files
The bitmap must be drawn in the OnDraw method of the canvas. This can be created by Right clicking in the body of the menuzone and then choosing Go OnDraw from the Canvas popup menu
The OnDraw method and the associated device context are part of the wxScrolledWindow class, from which MyCanvas was derived. The bitmap is part of a different class, MyFrame , but we can access it though the pointer, pFrame, which was saved in the constructor of MyCanvas
The OnDraw code is quit
dc.DrawBitmap (pFrame -> myBitmap, 0, 0 );
The code should compile and now draw a 16x16 or 32x32 black bitmap, depending on which new menu item is pressed.
If you get a compile error, then double-click the line in the compiler output window that lists the error, and you should be taken to the mistyped source code line. I have checked the code in this tutorial under Borland, MingW and gcc compilers