X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0286bbe9b363e9be0e6e7f348b91998f21e9f119..cfcc02a8a4f019e3846b73660209080602e44967:/samples/printing/printing.cpp diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index e0a29dc9dd..0b4c31accc 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -412,7 +412,16 @@ void MyFrame::Draw(wxDC& dc) dc.DrawBitmap( m_bitmap, 10, 10 ); #if wxUSE_GRAPHICS_CONTEXT - wxGraphicsContext *gc = dc.CreateGraphicsContext(); + wxGraphicsContext *gc = NULL; + + wxPrinterDC *printer_dc = wxDynamicCast( &dc, wxPrinterDC ); + if (printer_dc) + gc = wxGraphicsContext::Create( *printer_dc ); + + wxWindowDC *window_dc = wxDynamicCast( &dc, wxWindowDC ); + if (window_dc) + gc = wxGraphicsContext::Create( *window_dc ); + if (gc) { // make a path that contains a circle and some lines, centered at 100,100