memory dc must have bitmap selected into it before it can be used for measuring
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39221 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
4b40bcb44d
commit
b8aab4d28d
@ -350,6 +350,9 @@ def GetFullExtent(str, dc=None, enclose=True):
|
||||
def RenderToBitmap(str, background=None, enclose=1):
|
||||
"Return str rendered on a minumum size bitmap"
|
||||
dc = wx.MemoryDC()
|
||||
# Chicken and egg problem, we need a bitmap in the DC in order to
|
||||
# measure how big the bitmap should be...
|
||||
dc.SelectObject(wx.EmptyBitmap(1,1))
|
||||
width, height, dy = GetFullExtent(str, dc, enclose)
|
||||
bmp = wx.EmptyBitmap(width, height)
|
||||
dc.SelectObject(bmp)
|
||||
|
Loading…
Reference in New Issue
Block a user