Disable Drag&Drop of files in Richtextbox in .NET

790 Views Asked by At

I use a .NET richtextbox and I want to have the EnableAutoDragDrop property set to True. This allows user to drag&drop text, rtf and images around etc.

However, I need to process files dropped into the richtextbox myself - I do not want them to be embedded as OLE objects when they are dropped.

How can I overcome this? Is there any way to delete embedded files from richtextbox?

(I've found API DragAcceptFiles which doesn't work for some reason.)

Thanks!

2

There are 2 best solutions below

1
On

Try handling the DragDrop event.

Example.

0
On

You may try this MSDN article. If you do not wish to lock the file,you can use IO stream. Google it and It will sole your problem.