Drawing in a component


hope this question is not already answered before.

Is it possible to draw rectangles, circles, etc in a component, outside the paint routine ?

I want that when i press a button that some circles or lines will appear, but not using components.



Why not do it on the paint routine? It depends on what exactly you're trying to achieve, but you can set up a data structure as a member variable which is  an array of a struct which contains the coordinates of the bounds and the shape type. You just add to this when the button is pressed and trigger a repaint. Then in your paint routine you just draw anything that's in the array.

Hi Andrew,


yes, it's one way, but i wish there was a more easy way to do it.

What i need to do is that in a specific component, i have a progress indicator, and when i advance on the progress of configuration, i must paint a ball with a number inside.

And in other points i will need to draw more things and wanted to avoid doing it in the paint part.


Perhaps your Component is trying to be more than one Component… Perhaps you need to separate your objects into separate Components.