eran otzap
eran otzap

Reputation: 12533

Is there an event that occurs after DragDrop event?

I can't manage to find an event that would occur after I dropped a file in a richtextbox.

*when you drop a file into a Rtb the icon's image is copied on to the control if you downloaded a user control which derives from richtextbox, this control has a few method in which it manipulates RTF among those are AppendRtf(_rtf)

now I want to present u with a scenario which works

  1. I drag a file into the Rtb, I check if its a file being dragged onto the control if true I render all effects

    void txt_send_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) { txt_send.Clear(); if (e.Data.GetDataPresent(DataFormats.FileDrop, false) == true) { e.Effect = DragDropEffects.All; }

     }
    
  2. I drop the file ,here for this scenario all I do is update a boolean value that indicates the file as been dropped void txt_send_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { File_droped = true;
    }

*after this event (2) an image is inserted into the Rtb

  1. FINALLY in order to test the issue I presented above, I call the mouseUp event, which there I copy that image's RTF(Rich Text Format)

*so now I'll click the control, and the following event is dispatched

*I JUST WANT TO CLARIFY THAT IM AWARE THE MOUSEUP DOSE NOT ACCURE AFTER THE DRAGDROP EVENT, I ONLY ADD IT TO TEST THE ACCTUALL OPERATION I WANT TO PREFORM AND SEE THAT IT WORKS,

    void txt_send_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
    {
        if (File_droped)
        {
            txt_main.AppendRtf(txt_send.Rtf); 
        } 
    }

*now the file's icon (Image) is copied to another RichTextBox (THIS WORKS)

now again what I'm looking for is an actual event that occurs after the DragDrop Event, because I want this to preform after DragDrop as ended if I attempt to do this from inside the event, it won't work because the image only appears after the event txt_main.AppendRtf(txt_send.Rtf);

Upvotes: 2

Views: 1315

Answers (1)

Amy West
Amy West

Reputation: 163

These events occur for drag&drop operations in both WinForms and WPF:

RichTextBox.DragDrop
RichTextBox.DragEnter
RichTextBox.DragLeave
RichTextBox.DragOver

Upvotes: 1

Related Questions