Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to handle event in PictureBox?

How to handle event in PictureBox?

Scheduled Pinned Locked Moved C#
helptutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TanutAPI
    wrote on last edited by
    #1

    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);

    E 1 Reply Last reply
    0
    • T TanutAPI

      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);

      E Offline
      E Offline
      Enishi
      wrote on last edited by
      #2

      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.

      T 1 Reply Last reply
      0
      • E Enishi

        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.

        T Offline
        T Offline
        TanutAPI
        wrote on last edited by
        #3

        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(); }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups