How to show the contents of a Windows folder on a Windows form using .NET?

I want to show the contents of a folder in my window form, from where the user can copy the paste of the files you need, what type of container should I use for this purpose?

+4
source share
5 answers

Basically, you have two options. You can get the built-in control and use it in your application, there are many, but not very good ones, and you will have to pay for them.

Or you can use TreeView / ListView and create your own control that works best for you. Below is an example and source code.

+2
source

Another alternative is you can get the Windows API Code Pack , which contains a managed shell for actually managing the shell, which basically allows you to embed explorer directly in your application.

+1
source

before I used Ultra win tree (infra page management) to view all files with a tree view.

0
source

Consider using the FolderView and FileView controls from Shell MegaPack .

0
source

Assuming:

  • design requirements prohibit showing the actual location of files that the end user can copy or paste. Suppose all of the specified file names are devoid of path locations.

  • the list of files is "flat" (no tree type display required)

  • you must move or copy one or more files from the original "full" list to another "incomplete list"

I would create an interface with two ListViews in the panel: one column in the ListView is wide enough to display file names: enable multi-selection in both of them.

I would either use drag-and-drop using standard methods, or, more likely, I would create a set of arrow buttons to move items back and forth between ListViews. I can have separate delete buttons for each ListView and require the end user to confirm the deletion depending on the application.

If multiple copies are allowed (more than one list entry with identical contents), I would probably use some keyboard options to control this, especially if I was dragging /.

Depending on the application, I would consider letting the end user take “snapshots” of the current state of the two ListViews, which can then be “restored”: while a simple “Cancel” button can take care of the case when you want to reset all this.

0
source

Source: https://habr.com/ru/post/1305069/


All Articles