Avoid using wx.ClientDC

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@45877 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2007-05-08 02:44:48 +00:00
parent 551c802495
commit 6b4b24eee9

View File

@@ -136,19 +136,11 @@ class DragCanvas(wx.ScrolledWindow):
return shape return shape
return None return None
# Remove a shape from the display
def EraseShape(self, shape, dc):
r = shape.GetRect()
dc.SetClippingRect(r)
self.TileBackground(dc)
self.DrawShapes(dc)
dc.DestroyClippingRegion()
# Clears the background, then redraws it. If the DC is passed, then # Clears the background, then redraws it. If the DC is passed, then
# we only do so in the area so designated. Otherwise, it's the whole thing. # we only do so in the area so designated. Otherwise, it's the whole thing.
def OnEraseBackground(self, evt): def OnEraseBackground(self, evt):
dc = evt.GetDC() dc = evt.GetDC()
if not dc: if not dc:
dc = wx.ClientDC(self) dc = wx.ClientDC(self)
rect = self.GetUpdateRegion().GetBox() rect = self.GetUpdateRegion().GetBox()
@@ -231,11 +223,11 @@ class DragCanvas(wx.ScrolledWindow):
if dx <= tolerance and dy <= tolerance: if dx <= tolerance and dy <= tolerance:
return return
# erase the shape since it will be drawn independently now # refresh the area of the window where the shape was so it
dc = wx.ClientDC(self) # will get erased.
self.dragShape.shown = False self.dragShape.shown = False
self.EraseShape(self.dragShape, dc) self.RefreshRect(self.dragShape.GetRect(), True)
self.Update()
if self.dragShape.text: if self.dragShape.text:
self.dragImage = wx.DragString(self.dragShape.text, self.dragImage = wx.DragString(self.dragShape.text,