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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. got problem with sequence of event execution

got problem with sequence of event execution

Scheduled Pinned Locked Moved C#
helpquestionlearning
6 Posts 3 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.
  • K Offline
    K Offline
    Krazy Programmer
    wrote on last edited by
    #1

    Hi What i want to do ? I am displaying a picture in picture box When user drags the picture then it has to appear in the another picture box What i Did .. private void pictureBox1_MouseUp(object sender, MouseEventArgs e) { isdragged = true; } private void pictureBox2_MouseEnter(object sender, EventArgs e) { if (isdragged == true) { pictureBox2.ImageLocation = picpath; isdragged = false; } } isdragged is a boolean variable .... picpath is a string i have stored the image location After clicking on the picturebox1 and dragging it to the picture box 2 .. private void pictureBox2_MouseEnter event is not raising I mean to say no effect when mouse enters into the picturebox2 I know i have done a mistake somewhere Please tell me what i must do to solve this (* Dont tell me to read a basic book .. i have read it twice ...*) Joking Thanks and Regards

    If You win You need not Explain............ But If You Loose You Should not be there to Explain......

    G N 2 Replies Last reply
    0
    • K Krazy Programmer

      Hi What i want to do ? I am displaying a picture in picture box When user drags the picture then it has to appear in the another picture box What i Did .. private void pictureBox1_MouseUp(object sender, MouseEventArgs e) { isdragged = true; } private void pictureBox2_MouseEnter(object sender, EventArgs e) { if (isdragged == true) { pictureBox2.ImageLocation = picpath; isdragged = false; } } isdragged is a boolean variable .... picpath is a string i have stored the image location After clicking on the picturebox1 and dragging it to the picture box 2 .. private void pictureBox2_MouseEnter event is not raising I mean to say no effect when mouse enters into the picturebox2 I know i have done a mistake somewhere Please tell me what i must do to solve this (* Dont tell me to read a basic book .. i have read it twice ...*) Joking Thanks and Regards

      If You win You need not Explain............ But If You Loose You Should not be there to Explain......

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      If you click and drag, you don't get any MouseUp event in the first picture box...

      Krazy Programmer wrote:

      (* Dont tell me to read a basic book .. i have read it twice ...*)

      Third time is the charm. ;)

      Despite everything, the person most likely to be fooling you next is yourself.

      K 1 Reply Last reply
      0
      • K Krazy Programmer

        Hi What i want to do ? I am displaying a picture in picture box When user drags the picture then it has to appear in the another picture box What i Did .. private void pictureBox1_MouseUp(object sender, MouseEventArgs e) { isdragged = true; } private void pictureBox2_MouseEnter(object sender, EventArgs e) { if (isdragged == true) { pictureBox2.ImageLocation = picpath; isdragged = false; } } isdragged is a boolean variable .... picpath is a string i have stored the image location After clicking on the picturebox1 and dragging it to the picture box 2 .. private void pictureBox2_MouseEnter event is not raising I mean to say no effect when mouse enters into the picturebox2 I know i have done a mistake somewhere Please tell me what i must do to solve this (* Dont tell me to read a basic book .. i have read it twice ...*) Joking Thanks and Regards

        If You win You need not Explain............ But If You Loose You Should not be there to Explain......

        N Offline
        N Offline
        nelsonpaixao
        wrote on last edited by
        #3

        why drag? why dont you browse a picture and load it in a picturebox?

        OpenFileDialog open_file_dialog = new OpenFileDialog();
        DialogResult dialog_result = open_file_dialog.ShowDialog();
        if (dialog_result == DialogResult.OK)
        {
        mypicturebox.ImageLocation = open_file_dialog.FileName;

        // something more would be ...
        //string Image_Path = open_file_dialog.FileName;
        //Image img = Image.FromFile(open_file_dialog.FileName);
        //...
        }

        After that, dont know if you want a path to the picture or load/save them from/to a database. :doh:

        nelsonpaixao@yahoo.com.br trying to help & get help

        K 1 Reply Last reply
        0
        • G Guffa

          If you click and drag, you don't get any MouseUp event in the first picture box...

          Krazy Programmer wrote:

          (* Dont tell me to read a basic book .. i have read it twice ...*)

          Third time is the charm. ;)

          Despite everything, the person most likely to be fooling you next is yourself.

          K Offline
          K Offline
          Krazy Programmer
          wrote on last edited by
          #4

          Guffa wrote:

          Third time is the charm.

          YES , I know someone will tell this .. but not the correct answer Anyway Thanks I will be reading it again

          If You win You need not Explain............ But If You Loose You Should not be there to Explain......

          G 1 Reply Last reply
          0
          • N nelsonpaixao

            why drag? why dont you browse a picture and load it in a picturebox?

            OpenFileDialog open_file_dialog = new OpenFileDialog();
            DialogResult dialog_result = open_file_dialog.ShowDialog();
            if (dialog_result == DialogResult.OK)
            {
            mypicturebox.ImageLocation = open_file_dialog.FileName;

            // something more would be ...
            //string Image_Path = open_file_dialog.FileName;
            //Image img = Image.FromFile(open_file_dialog.FileName);
            //...
            }

            After that, dont know if you want a path to the picture or load/save them from/to a database. :doh:

            nelsonpaixao@yahoo.com.br trying to help & get help

            K Offline
            K Offline
            Krazy Programmer
            wrote on last edited by
            #5

            nelsonpaixao wrote:

            why drag?

            Requirement is drag and drop

            If You win You need not Explain............ But If You Loose You Should not be there to Explain......

            1 Reply Last reply
            0
            • K Krazy Programmer

              Guffa wrote:

              Third time is the charm.

              YES , I know someone will tell this .. but not the correct answer Anyway Thanks I will be reading it again

              If You win You need not Explain............ But If You Loose You Should not be there to Explain......

              G Offline
              G Offline
              Guffa
              wrote on last edited by
              #6

              Krazy Programmer wrote:

              but not the correct answer

              I think that it is. If you don't understand that you don't get an MouseUp event on a control where you don't release the mouse button, you are clearly missing some of the most fundamental ideas of the graphical interface and the event handling. The logical solution would be to go back and fill in the gaps.

              Despite everything, the person most likely to be fooling you next is yourself.

              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