// create a wxDC object wxDC dc; // set a clipping region dc.SetClippingRegion(50, 50, 100, 100); // draw something inside the clipping region dc.DrawLine(0, 0, 200, 200); // remove the clipping region dc.DestroyClippingRegion(); // draw something outside the clipping region dc.DrawLine(0, 0, 400, 400);
// create a wxDC object wxDC dc; // get the client size of a wxWindow object wxSize size = wxGetClientSize(window); // set a clipping region that covers the entire client area of the window dc.SetClippingRegion(0, 0, size.x, size.y); // draw something dc.DrawRectangle(0, 0, size.x, size.y);In this example, a wxDC object is created and the client size of a wxWindow object is obtained using the wxGetClientSize function. A clipping region is set to cover the entire client area of the window using the SetClippingRegion method. Finally, a rectangle is drawn using the DrawRectangle method.