Using the same way - you can't, as drawing is only allowed in paint events. But you can draw a rubber band of any shape in general. Just do it during a proper event call (or use a dedicated graphics item).