I am trying implement drag and drop feature in RichTextBox (windows common control). It works fine using the code shown below. However, the drag drop event is not getting triggered when I set the ReadOnly property to true. Is there anything that I am missing? or is that the right behaviour ? Please advice.
private void rtb_dragdrop(object sender, DragEventArgs e)
{
Console.WriteLine("Test");
}
private void rtb_dragenter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}
Obviously, setting the ReadOnly property to true in a RichTextBox will turn off the ability to do Drag and Drop operations.
A simple hack to mimic a read only RichTextBox:
Now your Drag and Drop operation should work automatically with the
EnabledAutoDragDropproperty set to true. No need to handle those drag enter and drop events.