X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a29df0623194319a0f7c670e22424f1f69159a80..ca2c1e0d50a905b631b622bfff43f0646bdfcfd2:/samples/printing/printing.cpp diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index e79361807e..61fcb8d06a 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -230,6 +230,12 @@ void MyApp::Draw(wxDC&dc) if (window_dc) gc = wxGraphicsContext::Create( *window_dc ); +#ifdef __WXMSW__ + wxEnhMetaFileDC *emf_dc = wxDynamicCast( &dc, wxEnhMetaFileDC ); + if (emf_dc) + gc = wxGraphicsContext::Create( *emf_dc ); +#endif + if (gc) { // make a path that contains a circle and some lines, centered at 100,100 @@ -248,14 +254,14 @@ void MyApp::Draw(wxDC&dc) // draw some text wxString text("Text by wxGraphicsContext"); - gc->SetFont( m_testFont, *wxBLUE ); - gc->DrawText(text, 50.0, 50.0); + gc->SetFont( m_testFont, *wxBLACK ); + gc->DrawText(text, 25.0, 60.0); // draw rectangle around the text double w, h, d, el; gc->GetTextExtent(text, &w, &h, &d, &el); - gc->SetPen( *wxBLUE_PEN ); - gc->DrawRectangle(50.0, 50.0, w, h); + gc->SetPen( *wxBLACK_PEN ); + gc->DrawRectangle(25.0, 60.0, w, h); delete gc; }