protected override void OnDragDrop(DragEventArgs
drgevent)
{
if (!ReadOnly)
{
if (Document != null)
{
View.Action = EditAction.None;
int SelStart = Selection.LogicalSelStart;
int DropStart = Document.PointToIntPos(Caret.Position);
object dataAsObject = drgevent.Data.GetData(typeof (string));
string s = null;
int SelLen = 0;
if (dataAsObject != null)
{
s = dataAsObject.ToString();
SelLen = s.Length;
}
//int SelLen=s.Replace ("\r\n","\n").Length ;
if (DropStart >= SelStart && DropStart <= SelStart + Math.Abs
(Selection.SelLength))
DropStart = SelStart;
else if (DropStart >= SelStart + SelLen)
DropStart -= SelLen;
Document.StartUndoCapture();
if ((drgevent.KeyState & 8) == 0)
{
_SyntaxBox.Selection.DeleteSelection();
Caret.Position = Document.IntPosToPoint(DropStart);
}
Document.InsertText(s, Caret.Position.X, Caret.Position.Y);
Document.EndUndoCapture();
Selection.SelStart = Document.PointToIntPos(Caret.Position);
Selection.SelLength = SelLen;
Document.ResetVisibleRows();
ScrollIntoView();
Redraw();
drgevent.Effect = DragDropEffects.All;
if (ParseOnPaste)
Document.ParseAll(true);
View.Action = EditAction.None;
}
}
}