I got the filepath and filename in richtextbox. I need to extracticon using extractassociated icon. i got listview type. but i need which is not of list view type. i want extract icon of any single file which was drag and drop to rich textbox and sent to client so that they can open by double clicking the icon.
private void rtbText_PreviewDragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effects = DragDropEffects.All;
}
else
{
e.Effects = DragDropEffects.None;
}
}
private void rtbText_PreviewDrop(object sender, DragEventArgs e)
{
System.Windows.Documents.TextRange range;
string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, true);
string s = "";
foreach (string File in FileList) s = s + " " + File;
range = new System.Windows.Documents.TextRange(rtbText.Document.ContentStart, rtbText.Document.ContentEnd);
range.Text = s;
}