+ const DWORD rc = ::GetLastError();
+ if ( rc != ERROR_INSUFFICIENT_BUFFER )
+ {
+ wxLogApiError(_T("GetDateFormat"), rc);
+
+ // fall back on wxDateTime, what else to do?
+ s = wxDateTime::Today().FormatDate();
+ break;
+ }
+ }
+
+ // the control adds a lot of extra space around separators
+ s.Replace(_T(","), _T(" , "));
+
+ int x, y;
+ dc.GetTextExtent(s, &x, &y);
+
+ wxSize best(x + 40 /* margin + arrows */, EDIT_HEIGHT_FROM_CHAR_HEIGHT(y));
+ CacheBestSize(best);
+ return best;