How to locate the drop position?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello folks,
i like to Drag and Drop "textdata" into an *multiline* RichTextBox.

The online doc explain to solve this problem by using code like this:


void InpFormelDragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
if(e.Data.GetDataPresent( typeof(myData))) {
myData Daten = (myData)e.Data.GetData(typeof(myData));
inpFormel.Text = Daten.aText;
}
}

.... but instead of replacing the existing text, I need to insert the text.
The insertposition have to be at mouse position.

How can I locate the position (e.g. Number of char into the string)
were the user like to drop the the text?

Thanks in advance for any help
Niels
 
Hi
i solve my problem by changing the drag + drop data to "Text" and using the
SelectStart Property of the RichTextBox.

Thank for reading and thinking.
Niels
 
Back
Top