Hello, sadly I'm a noob, and I can't manage to find an event that occurs after I drop 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 this control which derives from richtextbox, this control has a few methods in which manipulate RTF such as
AppendRtf(_rtf)
).
Now I want to present you with a scenario wich works.
1) I drag a file into the Rtb, I check if it's 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 secnario 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.
3) Finally, in order to test the issue I presented above, I call the
MouseUp
event , where I copy that image's RTF(Rich Text Format).
So now I click the control , and the following event is dispatched.
I just want to clarify, I'm aware that MouseUp
does not occur after the DragDrop
event, I only added it to test the operation I want to perform to ensure 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 I'm looking for is an actual event that occurs after the
DragDrop
event, becuase I want this to perform after
DragDrop
has 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);