In this example, a wxClientDC object is created to draw on the window. A wxBrush object is created with a solid red color and set to the device context using SetBrush. A rectangle is then drawn with the DrawRectangle function, which will be filled with the red brush. This example uses the wxWidgets package library. Example 2:c++ wxMemoryDC dc; wxBitmap bitmap(200,200); wxBrush brush(wxColour(0,255,0), wxBRUSHSTYLE_SOLID); //Create a solid green brush dc.SelectObject(bitmap); //Select the bitmap as target for drawing dc.SetBrush(brush); //Set the brush to the memory device context dc.DrawRectangle(0,0,200,200); //Draw a rectangle filled with the green brush ``` In this example, a wxMemoryDC object is used to draw on a bitmap instead of directly on the screen. A bitmap is created with a size of 200x200 pixels. A wxBrush object is created with a solid green color and set to the memory device context using SetBrush. A rectangle is then drawn with the DrawRectangle function, which will be filled with the green brush. This example uses the wxWidgets package library.