Я использую Icon.ExtractAssociatedIcon, чтобы получить значок файла, который пользователь выбирает, в openfiledialog.
Проблема заключается в том, что пользователь выбирает значок из общего сетевого ресурса, тогда свойство filename для openfiledialog находится в формате UNC, и это вызывает ArgumentException
in ExtractAssocaitedIcon
:
Value of '\\server\share\filename' is not valid for 'filePath'.
Stack Trace:
at System.Drawing.Icon.ExtractAssociatedIcon(String filePath, Int32 index)
Итак, мне задан файл, указанный как \\server\share\filename
, как мне получить значок?
Примечание..NET 2.0