I have a simple page. One Rich Text Box bound to a test table in my database.
I have turned the EnableAutoDragDrop to true.
Everything works great, the contents of the box are saved and able to pull back up when asked for.
My issue is dropping image into the RTB. If I drag them directly from the file manager (any type of image file) then I get an Icon with the file name that shows up, not the actual image.
If I open up Word and drop the image into Word, then drag it into the RTB then the image shows just fine.
I guess I dont understand the mechanics of the process between the file manager and word and my RTB. Can anyone elighten me?
The drag event can contain multiple format types that are determined by the source of the drag event. When I drag an image (.png) from a the file system to a C# control, I get this set of available formats (note you can get these from
DragEventArgs.Data.GetFormats())Now when I drag that same image on to word, and then to my C# control, I get this list of formats :
It is entirely up to the target control to determine how to handle the drag data, and which format(s) to use. MS Word may take the format
FileNameW, which is just the path to the file dropped, and read the image. While theRichTextBoxprobably takes theFileNameWand gets its icon.