]> git.saurik.com Git - wxWidgets.git/commitdiff
added GetTextExtent test
authorVáclav Slavík <vslavik@fastmail.fm>
Mon, 4 Oct 1999 09:18:00 +0000 (09:18 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Mon, 4 Oct 1999 09:18:00 +0000 (09:18 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3813 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/printing/printing.cpp

index f76894eb4f9ceabddcf513b035bb790cf0e991f8..2c9a75dde16f3705553c58dae977bcf2dc84440d 100644 (file)
@@ -479,6 +479,22 @@ void MyPrintout::DrawPageTwo(wxDC *dc)
     
     dc->DrawText("Some test text", 200, 200 );
     
+    { // GetTextExtent demo:
+        wxString words[7] = {"This ", "is ", "GetTextExtent ", "testing ", "string. ", "Enjoy ", "it!"};
+        long w, h;
+        long x = 200, y= 250;
+        wxFont fnt(15, wxSWISS, wxNORMAL, wxNORMAL);
+        
+        dc->SetFont(fnt);
+        for (int i = 0; i < 7; i++) {
+            dc->GetTextExtent(words[i], &w, &h);
+            dc->DrawRectangle(x, y, w, h);
+            dc->DrawText(words[i], x, y);
+            x += w;
+        }
+        dc->SetFont(* wxGetApp().m_testFont);
+    }
+    
     // TESTING
     
     int leftMargin = 20;