hi, am currently working on a assignment in which i hace to make a graphic using the g class blink on and off for certain intervals. i was wondering if someone would know how to make a graphic do so since i only know how to make a picture blink
It works like this: By default, the blink variable is set to false. When the paint event is fired a red rectangle is drawn and blink is set to true. When its fired again since blink is set to true, it clears the rectangle and sets blink back to false and it goes go on like this.
farooqaaa, That is a great code snippet you posted for the OP. But I do have one thing to suggest. I would use the Timer tick event to change the state of the variable. Not the paint event, as many thing can cause the paint event to be fired. if one is to expect that the blinking should be consistent. Then the toggle should also be done on interval, The paint event should only be used to paint, not change variables.
The code above would cause parts of the blinking graphic to act erratically if other windows were dragged around above the current one.
Although you did a great job of explaining your reasoning, and of course the code would certainly work either way.