Alsing.Windows.Forms.SyntaxBox.EditViewControl.OnDragDrop C# (CSharp) 메소드

OnDragDrop() 보호된 메소드

Overrides the default OnDragDrop
protected OnDragDrop ( DragEventArgs drgevent ) : void
drgevent System.Windows.Forms.DragEventArgs
리턴 void
        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;
                }
            }
        }