WPF 打开文件 打开路径对话框

摘要:
WPF在WinForm中调用OpenFileDialog和FolderBrowserDialog来实现响应函数OpenFileDiagnopenFileDialog=newOpenFileDiaog();打开文件对话框。标题=“选择文件”;打开文件对话框。过滤器=“zip文件|*.zip|rar文件|*.rar|所有文件|*.*”;打开文件Di

WPF调用WinForm中的 OpenFileDialog 和 FolderBrowserDialog 来实现响应的功能

 OpenFileDialog openFileDialog = newOpenFileDialog();
            openFileDialog.Title = "选择文件";
            openFileDialog.Filter = "zip文件|*.zip|rar文件|*.rar|所有文件|*.*";
            openFileDialog.FileName = string.Empty;
            openFileDialog.FilterIndex = 1;
            openFileDialog.RestoreDirectory = true;
            openFileDialog.DefaultExt = "zip";
            DialogResult result =openFileDialog.ShowDialog();
            if (result ==System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }
            string fileName =openFileDialog.FileName;
            this.textBox1.Text = fileName;
 FolderBrowserDialog m_Dialog = newFolderBrowserDialog();
            DialogResult result =m_Dialog.ShowDialog();

            if (result ==System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }
            string m_Dir =m_Dialog.SelectedPath.Trim();
            this.textBox1.Text = m_Dir;

免责声明:文章转载自《WPF 打开文件 打开路径对话框》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇FPGA使用技巧SpringCloud-OAuth2(二):实战篇下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

ArcGIS API For Android离线地图的实现

今天搞了一个ArcGIS API For Android离线地图的实现。效果如下:Android的版本是2.1main.xml,这里要说明的,初始化范围一定要有,不然会不能显示的。 <?xml version="1.0" encoding="utf-8"?> <com.esri.android.map.MapView xmln...

Swift-可选值(Optional)讲解

前提:Swift中有规定:对象中的任何属性在创建时,都必须要有明确的初始化值 1.定义可选类型 方式一:常规方式(不常用) var name : Optional<String> = nil 方式二:语法糖(常用) var name:String? = nil Optional理解:   Optional也是Objective-C没有的数据类型...

OPCDAAuto.dll的C#使用方法浅析

上次研究了.Net版本的OPC API dll,这次我采用OPCDAAuto.dll来介绍使用方法。以下为我的源代码,有详细的注释无需我多言。编译平台:VS2008SP1、WINXP、KEPServer除此之外,我也安装了西门子的Net2006和Step7,其中Net2006是负责OPC的,可能会在系统中创建一些dll之类的,并提供几个OPC服务器以下是我...

ExcelTools使用

using NPOI.SS.Formula.Functions; using NPOI.SS.UserModel; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; nam...

接口返回值结果转换成JSON

接口返回值结果转换成JSON,具体的方法如下: public static String GetJsonValue(String result,intindex,String key){ intindexloc,indexkey; String newstr; indexloc=result.indexOf(...

如何将WPF browser app 转换成WPF windows application

转载于:http://dotnetframework.blogspot.com.au/2011/01/wpf-browser-application-wpf-windows.html WPF Browser Application 是WPF 中较新的功能。其实它的基本概念,仍然是ClickOnce Application。所以在权限及安控的处理上,必须很小...