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. Getting a base control from event arg.

Getting a base control from event arg.

Scheduled Pinned Locked Moved C#
question
7 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.
  • D Offline
    D Offline
    Diego F
    wrote on last edited by
    #1

    Hi all. I have an application with two listviews that implement drag and drop (cod from this site), and when I'm dropping an item in the other listview, I need to get the address of the listview where the drag began. I have an event: protected override void OnDragDrop(DragEventArgs drgevent) How can I get, from drgevent, the listview who is the father of the control?

    Regards, Diego F.

    J 1 Reply Last reply
    0
    • D Diego F

      Hi all. I have an application with two listviews that implement drag and drop (cod from this site), and when I'm dropping an item in the other listview, I need to get the address of the listview where the drag began. I have an event: protected override void OnDragDrop(DragEventArgs drgevent) How can I get, from drgevent, the listview who is the father of the control?

      Regards, Diego F.

      J Offline
      J Offline
      joon vh
      wrote on last edited by
      #2

      I think your event should have an (object sender) and you could cast that into a ListView to have a reference. I thought all events always had (object sender), but obviously they don't. You could probably add it manually. protected override void OnDragDrop(object sender, DragEventArgs drgevent)


      Visual Studio can't evaluate this, can you? public object moo { __get { return moo; } __set { moo = value; } }

      D 1 Reply Last reply
      0
      • J joon vh

        I think your event should have an (object sender) and you could cast that into a ListView to have a reference. I thought all events always had (object sender), but obviously they don't. You could probably add it manually. protected override void OnDragDrop(object sender, DragEventArgs drgevent)


        Visual Studio can't evaluate this, can you? public object moo { __get { return moo; } __set { moo = value; } }

        D Offline
        D Offline
        Diego F
        wrote on last edited by
        #3

        Thank you, but I tried that and it gets a compilation error.

        Regards, Diego F.

        J 1 Reply Last reply
        0
        • D Diego F

          Thank you, but I tried that and it gets a compilation error.

          Regards, Diego F.

          J Offline
          J Offline
          joon vh
          wrote on last edited by
          #4

          you have to change everything that calls the event of course. I'll try to make some testcode when I have a minute. If you have some test-code you could send it...


          Visual Studio can't evaluate this, can you? public object moo { __get { return moo; } __set { moo = value; } }

          D 2 Replies Last reply
          0
          • J joon vh

            you have to change everything that calls the event of course. I'll try to make some testcode when I have a minute. If you have some test-code you could send it...


            Visual Studio can't evaluate this, can you? public object moo { __get { return moo; } __set { moo = value; } }

            D Offline
            D Offline
            Diego F
            wrote on last edited by
            #5

            I get the code from here and I'm dealing with the onDragDrop event. My idea is to add to the LargeImageList in the second ListView the image from the drag item in the first ListView. I tried that: int indice = ((ListViewItem)data.DragItems[i]).Index; ListView lv = data.ListView; base.LargeImageList.Images.Add(lv.LargeImageList.Images[indice]); But it doesn't work.

            Regards, Diego F.

            1 Reply Last reply
            0
            • J joon vh

              you have to change everything that calls the event of course. I'll try to make some testcode when I have a minute. If you have some test-code you could send it...


              Visual Studio can't evaluate this, can you? public object moo { __get { return moo; } __set { moo = value; } }

              D Offline
              D Offline
              Diego F
              wrote on last edited by
              #6

              I get the code from here and I'm dealing with the onDragDrop event. My idea is to add to the LargeImageList in the second ListView the image from the drag item in the first ListView. I tried that: int indice = ((ListViewItem)data.DragItems[i]).Index; ListView lv = data.ListView; base.LargeImageList.Images.Add(lv.LargeImageList.Images[indice]); But it doesn't work.

              Regards, Diego F.

              D 1 Reply Last reply
              0
              • D Diego F

                I get the code from here and I'm dealing with the onDragDrop event. My idea is to add to the LargeImageList in the second ListView the image from the drag item in the first ListView. I tried that: int indice = ((ListViewItem)data.DragItems[i]).Index; ListView lv = data.ListView; base.LargeImageList.Images.Add(lv.LargeImageList.Images[indice]); But it doesn't work.

                Regards, Diego F.

                D Offline
                D Offline
                Diego F
                wrote on last edited by
                #7

                I changed the code and now it is that: if (data.ListView.LargeImageList.Images.Count > 0) foreach (Image im in data.ListView.LargeImageList.Images) base.LargeImageList.Images.Add(im); Now it partially works. The problem is that if I open two documents and move items from one to the other, each one mantain it's imagelists and we have: listview 1 listview2 ---------- --------- image1_1 image2_1 now I move image2_1 to listview1 and it takes the picture from image1_1, so I get two images with the same picture.

                Regards, Diego F.

                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