From 67e9829b55b72f480abbed64195667a0233fd87b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 25 Mar 2021 14:46:37 +0100 Subject: [PATCH] Remove unneeded wxClientDC wxDateTimePickerCtrl::DoGetBestSize() Just call GetTextExtent() on the window itself, it does the same thing anyhow. No real changes, just a tiny simplification. --- src/msw/datetimectrl.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/msw/datetimectrl.cpp b/src/msw/datetimectrl.cpp index 41059fa360..25a6ba97d3 100644 --- a/src/msw/datetimectrl.cpp +++ b/src/msw/datetimectrl.cpp @@ -162,8 +162,6 @@ void wxDateTimePickerCtrl::SetNullText(const wxString& text) wxSize wxDateTimePickerCtrl::DoGetBestSize() const { - wxClientDC dc(const_cast(this)); - // Use the same native format as the underlying native control. #if wxUSE_INTL wxString s = wxDateTime::Now().Format(wxLocale::GetOSInfo(MSWGetFormat())); @@ -177,7 +175,7 @@ wxSize wxDateTimePickerCtrl::DoGetBestSize() const // the width of the month string varies a lot, so try to account for it s += wxS("W"); - wxSize size = dc.GetTextExtent(s); + wxSize size = GetTextExtent(s); // We can ask the control itself to compute its ideal size, but we only use // it for the horizontal component: the vertical size is not computed