Drag and Drop with custom controls

G

Guest

I have what is probably a stupid question, but I have an array of controls
based on a custom control I want to allow users to drag and drop from one
form (similar to a toolbox) onto the primary form. The custom control has a
bitmap and contains text that varies among the array of custom controls on
the first form. I realize the DoDragDrop function permits passing of text or
image data, but is there any way to pass both pieces of information to the
primary form?
 
S

Sijin Joseph

The DoDragDrop method accepts an object for data so you can use any pass
in any kind of data, it's upto the client to recognize the data.

So you could make a simple class like

public class ImageAndText
{
public string text;
public Image image;
}

and then pass this as the data to DoDragDrop

Let me know if you face problems with this.

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph
 
G

Guest

Thanks! That's it!

Sijin Joseph said:
The DoDragDrop method accepts an object for data so you can use any pass
in any kind of data, it's upto the client to recognize the data.

So you could make a simple class like

public class ImageAndText
{
public string text;
public Image image;
}

and then pass this as the data to DoDragDrop

Let me know if you face problems with this.

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top