diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index 735b36f391..4b15b80930 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -234,7 +234,7 @@ void MyApp::Draw(wxDC&dc) { // make a path that contains a circle and some lines, centered at 100,100 gc->SetPen( *wxRED_PEN ); - gc->SetFont( m_testFont, *wxGREEN ); + wxGraphicsPath path = gc->CreatePath(); path.AddCircle( 50.0, 50.0, 50.0 ); path.MoveToPoint(0.0, 50.0); @@ -246,6 +246,17 @@ void MyApp::Draw(wxDC&dc) gc->StrokePath(path); + // draw some text + wxString text("This text is drawn by wxGraphicsContext"); + gc->SetFont( m_testFont, *wxBLUE ); + gc->DrawText(text, 50.0, 50.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); + delete gc; } #endif