A couple demo tweaks

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15244 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2002-04-23 15:58:41 +00:00
parent 2a74d1415b
commit f2a10cdc48
2 changed files with 5 additions and 4 deletions

View File

@ -64,18 +64,19 @@ class DragCanvas(wxScrolledWindow):
# Make a shape from some text
text = "Some Text"
bg_colour = wxColour(57, 115, 57) # matches the bg image
font = wxFont(15, wxROMAN, wxNORMAL, wxBOLD)
textExtent = self.GetFullTextExtent(text, font)
bmp = wxEmptyBitmap(textExtent[0], textExtent[1])
dc = wxMemoryDC()
dc.SelectObject(bmp)
dc.SetBackground(wxBrush(bg_colour, wxSOLID))
dc.Clear()
dc.SetTextForeground(wxRED)
dc.SetFont(font)
dc.DrawText(text, 0, 0)
dc.SelectObject(wxNullBitmap)
del dc
mask = wxMaskColour(bmp, wxWHITE)
mask = wxMaskColour(bmp, bg_colour)
bmp.SetMask(mask)
shape = DragShape(bmp)
shape.pos = wxPoint(5, 100)

View File

@ -59,10 +59,10 @@ class TestPanel(wxPanel):
EVT_RIGHT_UP(self, self.OnRightClick)
EVT_MENU(self, wxID_OPEN, self.OnFileOpenDialog)
EVT_MENU_RANGE(self, wxID_FILE1, wxID_FILE9, self.OnFileHistory)
EVT_WINDOW_DESTROY(self, self.Cleanup)
def __del__(self):
def Cleanup(self, *args):
del self.filehistory
self.menu.Destroy()