don't use deprecated GetTextExtent() overload

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45853 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-05-05 21:39:04 +00:00
parent 2f6550d9c2
commit 8f3447c289

View File

@@ -79,13 +79,10 @@ void wxFontPreviewer::OnPaint(wxPaintEvent& WXUNUSED(event))
if ( font.Ok() ) if ( font.Ok() )
{ {
dc.SetFont(font); dc.SetFont(font);
// Calculate vertical centre
long w = 0, h = 0;
dc.GetTextExtent( wxT("X"), &w, &h);
dc.SetTextForeground(GetForegroundColour()); dc.SetTextForeground(GetForegroundColour());
dc.SetClippingRegion(2, 2, size.x-4, size.y-4); dc.SetClippingRegion(2, 2, size.x-4, size.y-4);
dc.DrawText(_("ABCDEFGabcdefg12345"), dc.DrawText(_("ABCDEFGabcdefg12345"),
10, size.y/2 - h/2); 10, (size.y - dc.GetTextExtent(wxT("X")).y)/2);
dc.DestroyClippingRegion(); dc.DestroyClippingRegion();
} }
} }