Doc typos corrected, added wxDIALOG_UNIT_COMPATIBILITY test, made file open

error result in a message box (docview.cpp)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7712 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-07-08 10:29:17 +00:00
parent 92eaf25bd0
commit 3a035fb95f
5 changed files with 28 additions and 8 deletions

View File

@@ -1344,7 +1344,11 @@ int wxWindow::GetCharWidth() const
{
// +1 is needed because Windows apparently adds it when calculating the
// dialog units size in pixels
#if wxDIALOG_UNIT_COMPATIBILITY
return wxGetTextMetrics(this).tmAveCharWidth ;
#else
return wxGetTextMetrics(this).tmAveCharWidth + 1;
#endif
}
void wxWindow::GetTextExtent(const wxString& string,
@@ -4279,21 +4283,25 @@ static TEXTMETRIC wxGetTextMetrics(const wxWindow *win)
HWND hwnd = GetHwndOf(win);
HDC hdc = ::GetDC(hwnd);
#if !wxDIALOG_UNIT_COMPATIBILITY
// and select the current font into it
HFONT hfont = GetHfontOf(win->GetFont());
if ( hfont )
{
hfont = (HFONT)::SelectObject(hdc, hfont);
}
#endif
// finally retrieve the text metrics from it
GetTextMetrics(hdc, &tm);
#if !wxDIALOG_UNIT_COMPATIBILITY
// and clean up
if ( hfont )
{
(void)::SelectObject(hdc, hfont);
}
#endif
::ReleaseDC(hwnd, hdc);