disallow creation of wxDC objects and made wxDC an ABC; use wxDCTemp instead of wxDC in wx code; fixed WinCE bug with deleting a DC which should be released in wxListBox::MSWOnMeasure()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36564 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -776,16 +776,19 @@ bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item)
|
||||
HDC hdc = CreateIC(wxT("DISPLAY"), NULL, NULL, 0);
|
||||
#endif
|
||||
|
||||
wxDC dc;
|
||||
dc.SetHDC((WXHDC)hdc);
|
||||
dc.SetFont(GetFont());
|
||||
{
|
||||
wxDCTemp dc((WXHDC)hdc);
|
||||
dc.SetFont(GetFont());
|
||||
|
||||
pStruct->itemHeight = dc.GetCharHeight() + 2*OWNER_DRAWN_LISTBOX_EXTRA_SPACE;
|
||||
pStruct->itemWidth = dc.GetCharWidth();
|
||||
|
||||
dc.SetHDC(0);
|
||||
pStruct->itemHeight = dc.GetCharHeight() + 2*OWNER_DRAWN_LISTBOX_EXTRA_SPACE;
|
||||
pStruct->itemWidth = dc.GetCharWidth();
|
||||
}
|
||||
|
||||
#ifdef __WXWINCE__
|
||||
ReleaseDC(NULL, hdc);
|
||||
#else
|
||||
DeleteDC(hdc);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user