动态显示所选文件的路径和文件名 [英] dynamic display of path and file name of selected file

查看:79
本文介绍了动态显示所选文件的路径和文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个文件打开对话框,该对话框允许用户从驱动器中选择文件.当用户在表单的标题栏中进行选择时,我需要动态显示所选文件的路径和文件名.

例如:

C:\ Documents and Settings \我的文档\我的图片

在上面的示例中,我需要在用户选择时动态显示其中的每一个.

c:\ Documents and Settings
c:\ Documents and Settings \我的文档
c:\ Documents and Settings \我的文档\我的图片等.

你能帮我吗?

在此先感谢您.

Hi all,

I have a file open dialog box which allows the user to select a file from the drive. I need to display the path and file name of the selected file dynamically as and when the user selects in the title bar of the form.

For ex:

C:\Documents and Settings\My Documents\My Pictures

In the above example I need to dynamically display each of these when user selects.

c:\Documents and Settings
c:\Documents and Settings\My Documents
c:\Documents and Settings\My Documents\My Pictures etc..

Can you help me?

Thanks in advance.

推荐答案

您可以使用以下代码更改表单标题文本:
在文件选择处理程序中
You change the form title text with the code below:
// in your file select handler
this.Text = selectedfilename;


您不能为每个子文件夹动态地执行此操作,只能针对fileOk事件

没有选择文件夹的事件...
OpenFileDialogClass是密封的,因此您不能轻松地创建自定义对话框...
You can''t do that dynamically for each subfolder, only for the fileOk event

There is no event for the selection of folders...
The OpenFileDialogClass is sealed, so you can''t make a custom Dialog easily...


这篇关于动态显示所选文件的路径和文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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