hi there i have been working with C# for quite some time. I want to know How i will be able to insert an image in the form and get it blinked. Rather i have inserted the Image But i dont know how to blink it
thanks to all of u. It worked. but my objective was not only to blink the image but also to move it from left to right and right to left in the form. i have done it by changing the X property of location. But i m still unable to do it. Thanks for any suggestion
if you do it in the same timer you will have a problem of having the image move very slowly, it is because image is blinking like every 3 seconds, but is should move like every milliseconds, so you have to use timer interval like 1 milliseconds and every 3 hundred times you gotta blink the image ones. and every time you have to move image. Or you can use two timers. while one of them blinks the image the other can move it right to left. this is a good way to do it. but timer class runs on the same thread with GUI so you might get kind of slowness, if you don't want that there is a multithreaded timer on System.Timers. you can use that too(I just saw it on MSDN now. :)) it should move your image better but uses more of your CPU. anyway here is my code.
public partial class Form1 : Form
/* form.size = 770,130 (770 is important since image will turn from a point close to that location,
* in my case it turns from 677)
* image will move between leftLocaton and write location.
private int leftLocation = 12, rightLocation = 677;
/* difference is used to move image to a directon. if difference is positive image will move to
* right side, in contrast it will move to left side. if you give it a higher value,
* image will move faster.
private int difference = 2;
/* Timer1 makes image blink.
private void timer1_Tick(object sender, EventArgs e)
if (pictureBox1.Visible == true)
pictureBox1.Visible = false;
pictureBox1.Visible = true;
private void Form1_Load(object sender, EventArgs e)
timer1.Interval = 300;
timer2.Interval = 1;
/*Timer2 moves image left and write*/
private void timer2_Tick(object sender, EventArgs e)
/*this statement changes the direction of the image, if it goes out of bounds.*/
if ((pictureBox1.Left > rightLocation) || (pictureBox1.Left < leftLocation))
difference *= -1;
pictureBox1.Left += difference;
root = tkinter.Tk()
buttons=[i for i in range(10)]
#If specific button is pressed, output "YES"
for num in buttons: