added GetTextExtent test

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3813 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
1999-10-04 09:18:00 +00:00
parent fa3e4baf13
commit d57bf68500

View 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;