Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何将OpenFileDialog设置为接受http://和本地文件?_C#_.net_Openfiledialog - Fatal编程技术网

C# 如何将OpenFileDialog设置为接受http://和本地文件?

C# 如何将OpenFileDialog设置为接受http://和本地文件?,c#,.net,openfiledialog,C#,.net,Openfiledialog,对于C#Forms应用程序,我希望允许OpenFileDialog返回URL以及本地和网络文件名。我怎样才能让它这样做呢 using (OpenFileDialog dlg = new OpenFileDialog()) { dlg.Title = FormStrings.Framework_rdlAddFileTitle; dlg.CheckFileExists = true; dlg.DefaultExt = "rdlx"; dlg.Filter = @"RD

对于C#Forms应用程序,我希望允许OpenFileDialog返回URL以及本地和网络文件名。我怎样才能让它这样做呢

using (OpenFileDialog dlg = new OpenFileDialog())
{
    dlg.Title = FormStrings.Framework_rdlAddFileTitle;
    dlg.CheckFileExists = true;
    dlg.DefaultExt = "rdlx";
    dlg.Filter = @"RDL(X) files|*.rdlx;*.rdl|RDLX files|*.rdlx|RDL files)|*.rdl|All files|*.*";
    dlg.Multiselect = false;
    if (dlg.ShowDialog(GetParentHWnd(doc)) != DialogResult.OK)
        return;

看起来OpenFileDialog不支持它--。
我将为包含该文件的URL创建一个文本框。然后在代码中解析并获取它。

您打算如何使用它?请显示您的代码。我在您提供的链接中找不到任何对http协议的引用。在我自己的测试中,我发现“打开文件”对话框将允许使用https协议浏览Office 365目录,但这种行为是不一致的。如果能得到一个明确处理此行为的引用,那就太好了。对于任意http源(例如图像文件),我发现它会将文件下载到用户的临时目录,并在Filename属性中返回临时路径。我找不到一种方法来启用/禁用此功能,或者区分原始本地文件和下载的远程文件。