在C#或VB.Net中自定义OpenFileDialog [英] Customize OpenFileDialog in C# or VB.Net

查看:196
本文介绍了在C#或VB.Net中自定义OpenFileDialog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何自定义打开文件对话框,以与用户单击文件相同的顺序选择多个文件.我正在使用openFileDialog.FileNames获取所有选定的文件,但是它将选定的文件名以升序而不是选定的顺序进行排序.

How to customize open file dialog to select multiple files with same order as user click the file. I am getting all selected files using openFileDialog.FileNames but it sort the selected file names to ascending order instead of selected order.

推荐答案

如何自定义打开文件对话框,以按用户单击文件的相同顺序选择多个文件.我正在使用openFileDialog.FileNames获取所有选定的文件,但是它将选定的文件名以升序而不是选定的顺序排序.
How to customize open file dialog to select multiple files with same order as user click the file. I am getting all selected files using openFileDialog.FileNames but it sort the selected file names to ascending order instead of selected order.


要自定义fileOpenDialog控件以使其表现出所需的行为,您将必须创建自己的自定义控件并添加所需的功能.您可以从添加新"菜单中选择一个自定义控件(我认为这是较难的方法),也可以创建 一个新的窗体,并使它看起来像一个OpenFileDialog窗口.在此新控件(窗体)中,您可以按照选择文件的顺序将每个选定文件添加到列表中(先进先出).您可以在此新表单的鼠标单击"事件中执行此操作 将每个选定文件按选定顺序添加到列表中.这几乎就像重新发明轮子(重新创建已经创建的东西)一样-除了您要自定义此表单的部分以使其行为不同于 通用openfileDiadlog控件.


To customize the fileOpenDialog control to behave as you want you will have to create your own custom control and add the desired features.  You can either select a custom control from the Add New menu (I think this is the harder way) or you can create a new form and make it look like an OpenFileDialog window.  In this new control (form) you can add each selected file to a list (first in, first out) in the order which you select the files.  You can do this in the Mouse click event of this new form to add each selected file to your list in the order it was selected.  It's almost like re-inventing the wheel (recreating something that has already been created) -- except for the part that you are customizing this form to behave differently than the generic openfileDiadlog control.


这篇关于在C#或VB.Net中自定义OpenFileDialog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆