protected void OnDragOver(object sender, DragEventArgs e)
{
if (!textArea.Focused)
{
textArea.Focus();
}
Point p = textArea.PointToClient(new Point(e.X, e.Y));
if (textArea.TextView.DrawingPosition.Contains(p.X, p.Y))
{
TextLocation realmousepos = textArea.TextView.GetLogicalPosition(p.X - textArea.TextView.DrawingPosition.X, p.Y - textArea.TextView.DrawingPosition.Y); int lineNr = Math.Min(textArea.Document.TotalNumberOfLines - 1, Math.Max(0, realmousepos.Y));
textArea.Caret.Position = new TextLocation(realmousepos.X, lineNr);
textArea.SetDesiredColumn();
if (e.Data.GetDataPresent(typeof(string)) && !textArea.IsReadOnly(textArea.Caret.Offset))
{
e.Effect = GetDragDropEffect(e);
}
else
{
e.Effect = DragDropEffects.None;
}
}
else
{
e.Effect = DragDropEffects.None;
}
}