add events to draw background and foreground