Eran Otzap

Eran Otzap

  • NA
  • 4
  • 5.4k

is there an event proceding the DragDrop Event

Feb 5 2011 10:41 AM
hello , sadly im a noob  , and i cant manage to find an event that would accure after i droped a file in a richtextbox

*when u drop a file into a Rtb the icon's image is copied on to the control if u i downloaded a userr control wich derives from richtextbox , this control as a few method in wich it manipulates RTF among does are  AppendRtf(_rtf) 

now i want to present u with a secnario wich works 
1) i drag a file into the Rtb, i check if its a file deing draged 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 secnario all i do is update a boolean value that indicates the file as been droped
 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 

3)  FINALLY  in order to test the issue i presented above , i call the mouseUp event , wich there i copy that image's RTF(Rich Text Format)

*so now ill 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 anouther RichTextBox (THIS WORKS)

now again what im looking for is an acctuall event that accures after the DragDrop Event , becuase i want this to preform after DragDrop as ended
if i attempt to do this from inside the event ,it wont work becuase the image only appears after the event 
 txt_main.AppendRtf(txt_send.Rtf);  


Answers (2)