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