I have a custom app which needs to support Drag and Drop.
On Dragging the grid in my app, in its DoDragDrop method I have provided the object to be dropped in a serialized format.
When the drop is to one of my apps, it is able to deserailize the string and create the object.
What I want to do is allow the source app to be able to drop into NotePad/TextPad as well. I can see that I can drag and drop files from windows explorer to Notepad , but am not able to drag and drop plain text to NotePad. Guess it checks the DataFormat in the DragEnter event and dis-allows strings but allows files to be dropped into it.
- Is there a way to change yr format in the source app so that it provides a temp file / a string.
- Is it possible to provide the data in 2 formats so that the target drop can accept whichever format it is happy with?
thanks in advance!
You can add multiple formats of your data to the DataObject you pass into the DoDragDrop call, so just add another call to SetData to add the new formats. This is the most appropriate implementation, this way the Drop target can query for available formats and choose the one it likes best.