开发者

WPF - Drag & Drop file extract icon and convert to bitmap (show on button or other object)

I'm working with WPF, and trying to implement a form to receive a Drag and Drop link, and assign to a button on a record (attach links to files to a record).

I can get the link path with no issue. I'm stuck trying to extract the icon file from the link, and convert and render it.

    private void frmMain_Drop(object sender, DragEventArgs e)
    {
        String[] sFileList = (String[])e.Data.Ge开发者_StackOverflowtData(DataFormats.FileDrop);
        foreach (String sFilename in sFileList)
        {

            String sNew = sFilename;
        }
    }

That is what I have so far.

Thanks!


Would this work for you?

myImageControl.Source = new BitmapImage(new Uri(sFilename));

Where myImageControl is an Image declared somewhere in your application's XAML:

<Image x:Name="myImageControl" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜