Click here to Skip to main content
16,018,294 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,

I am currently writing an application which allows users to save multiple paragraphs (as Paragraph objects).

These will be stored in the background and displayed to the user as a treeview with each node representing a stored paragraph.

The idea is to allow the user to drag their selected TreeNode (Paragraph) and drop it onto a RichTextBox.

The RichTextBox should then be updated with the Paragraph which is associated with the TreeNode they dragged and dropped, at the point they dropped it.

I cannot get the RichTextBox to accept any dragged data other than plain text when using the required PreviewDrag, DragOver and Drop events (the drop event never even fires).

It is important that the formatted text is dropped into the RichTextBox at the location the user drops it.

I know this is possible as when you have two RichTextBoxes you can easily drag and drop formatted text from one to the other.

I have tried many DataFormats to set the DragDrop.DoDragDrop DataObject to but the only one I can seem to get the RichTextBox to accept is the simple unformatted string!

Does anyone have any ideas on how I can achieve this?

Cheers,

Doug
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900