How to handle event in PictureBox?
-
-
I use this code to handle my event, but DoubleClick event not work. Can some one help me? thanks. pictureBox.DoubleClick += new System.EventHandler(mouseDoubleClick); pictureBox.MouseDown += new System.Windows.Forms.MouseEventHandler(MouseDown);
hi, i have tested it and it works. here are the 2 lines of my code this.pictureBox1.DoubleClick += new System.EventHandler(pictureBox1_DoubleClick); this.pictureBox1.MouseDown +=new MouseEventHandler(pictureBox1_MouseDown); Make sure u get the sender and event args and no exception is skipping ur code. I made a pic box which changes the location on double click and changes image in mouse down , show the methods code to see whats wrong.
-
hi, i have tested it and it works. here are the 2 lines of my code this.pictureBox1.DoubleClick += new System.EventHandler(pictureBox1_DoubleClick); this.pictureBox1.MouseDown +=new MouseEventHandler(pictureBox1_MouseDown); Make sure u get the sender and event args and no exception is skipping ur code. I made a pic box which changes the location on double click and changes image in mouse down , show the methods code to see whats wrong.
Thanks for your answer. there are my code it's a thumpnails image. method doubleclick for open image. and mousedown for dragdrop image to my other panel. pictureBox.DoubleClick += new System.EventHandler(mouseDoubleClick); pictureBox.MouseDown += new System.Windows.Forms.MouseEventHandler(MouseDown); public void MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { PictureBox pb=(PictureBox)sender; pb.DoDragDrop(filename,DragDropEffects.Copy); } public void mouseDoubleClick(object sender, System.EventArgs e) { System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.FileName=filename; proc.Start(); }