This is most probably going to be simple or not as difficult as I am making it to be but I am missing something here. I have a canvas - Canvas1 with a picture. I have relative locations to Canvas1 stored as my_x and my_y.
How do I draw a red circle with a known diameter of my_d using my_x and my_y anytime I want to do this into Canvas1. Next once I have accomplished that make the red circle blink at an interval of my_t. The interval is most probably a Timer but again I am missing how to control the Paint event of Canvas1 other than when the program starts
[quote=144923:@Dave S]canvas1.invalidate
will force the canvas to execute the PAINT event at the next idle cycle
canvas1.refresh forces it to repaint “now”… Invalidate is the more reccommended method[/quote]
[quote=144923:@Dave S]canvas1.invalidate
will force the canvas to execute the PAINT event at the next idle cycle
canvas1.refresh forces it to repaint “now”… Invalidate is the more reccommended method[/quote]
So is it not that inefficient to use the invalidate method multiple times when you only need one refresh?
Not at all.
Whats inefficient is using refresh after every change.
You could be forcing 15 repaints when 1 will do.
One call to invalidate, or 200 calls to invalidate: it just sets the area as dirty, and then when the OS is ready it paints it.
Once.
Then not again unless its marked dirty again.
One paint event is much less expensive than 200 ‘mark the area as dirty’ calls.
And hugely less expensive than 200 ‘paint the whole thing now’ calls
Thanks for that. What the Refresh function does is what I thought the Invalidate function does and I had no idea what the difference was. All I knew was to avoid the refresh function.
Thanks for that. What the Refresh function does is what I thought the Invalidate function does and I had no idea what the difference was. All I knew was to avoid the refresh function.