- ListView как windows explorer
- 4 ответа
- Похожие вопросы:
- Walkthrough: Creating an Explorer Style Interface with the ListView and TreeView Controls Using the Designer
- To create the form containing a ListView and TreeView control
- Testing the Application
- To test the form
- Next Steps
- Общие сведения об элементе управления ListView (Windows Forms) ListView Control Overview (Windows Forms)
- Что можно сделать с помощью элемента управления ListView What You Can Do with the ListView Control
- Элемент управления ListView (Windows Forms) ListView Control (Windows Forms)
- в этом разделе In This Section
- Справочник Reference
- Связанные разделы Related Sections
ListView как windows explorer
знаете ли вы какой-нибудь хороший пример, как создать listView, который будет выглядеть и имеет те же методы, что и windows explorer?
копирование, вставка, отображение миниатюр ??
Я должен использовать listView, потому что я не могу позволить пользователю изменить каталог, и я не могу отключить эту опцию в windows explorer(я имею в виду место, где я могу нажать, чтобы перейти вверх или вниз или поставить путь.
4 ответа
я использую treeView и listView для отображения файлов и папок, таких как Windows Explorer. Кто-нибудь может мне помочь, как получить ICONs файлов и папок, чтобы вставить их перед именем папки или именем файла в treeView и listView? Заранее спасибо!
Я хочу иметь клавиатурную навигацию, которая находится в IconView из Windows Explorer, то есть если мы переместимся в конец ширины экрана, то выбор должен переместиться в следующую строку.
Я рекомендовал этот проект, но никогда не слышал о нем жалоб. Обратите внимание, что встраиваемый браузер доступен начиная с Vista, он обернут классом ExplorerBrowser, доступным в пакете кода Windows API .
Имейте в виду, что такого рода решения ставят много зависимостей в ваш проект. Подумайте о том, чтобы взвесить эту стоимость против простой реализации события OpenFileDialog FileOk и отмены нажатия кнопки OK, если вам не нравится путь.
Это не тривиальная задача, но вы можете взглянуть на этот проект . Он находится в VB.Net году, но может послужить источником вдохновения.
Я что-то написал, но я не знаю, как добавить событие при нажатии на значок, чтобы получить путь к этому значку.
Как перестроить этот код ??
Мне интересно, есть ли какой-нибудь способ сделать такой элемент управления в автоматическом запуске windows explorer, когда вы подключаете устройство. Я думал, что это может быть listview-контроль в более или менее измененном виде, но я ничего не смог найти в Google. Я также проверил много.
У меня есть куча файлов, перечисленных в listview, и я хочу знать, можно ли перетащить файлы в Windows Explorer? Если да, то как? Я только, кажется, нахожу примеры обратного. Спасибо!
Вы можете использовать Graphics.DrawImage для загрузки файла jog и создания из него миниатюры. Это будет работать только для файлов изображений.
Чтобы получить миниатюры других типов файлов, необходимо использовать интерфейс shell IExtractIcon.
Для copying/pasting, используйте формат DataFormats.FileDrop с полными путями к файлам.
Готовую альтернативу смотрите в нашем элементе управления FileView .
Похожие вопросы:
В Windows Explorer в Windows 7 позиции в ListView имеют гибкую маржу. Таким образом, все значки помещаются в область ListView. Как я могу сделать панель, которая реализована таким образом? WrapPanel.
Как мне получить тему explorer в WPF ListView? Я знаю, что один ответ-это GridView, но это похоже на представление деталей в Windows Explorer. Мне нужен список, плитки и значки , которые выглядят.
Как я могу заставить ListView имитировать ListView в Windows Explorer с правой стороны? Например, как я могу получить значки в ListView и получить стрелки?
я использую treeView и listView для отображения файлов и папок, таких как Windows Explorer. Кто-нибудь может мне помочь, как получить ICONs файлов и папок, чтобы вставить их перед именем папки или.
Я хочу иметь клавиатурную навигацию, которая находится в IconView из Windows Explorer, то есть если мы переместимся в конец ширины экрана, то выбор должен переместиться в следующую строку.
Мне интересно, есть ли какой-нибудь способ сделать такой элемент управления в автоматическом запуске windows explorer, когда вы подключаете устройство. Я думал, что это может быть listview-контроль.
У меня есть куча файлов, перечисленных в listview, и я хочу знать, можно ли перетащить файлы в Windows Explorer? Если да, то как? Я только, кажется, нахожу примеры обратного. Спасибо!
У меня есть a ListView , содержащий список файлов: hList = CreateWindowEx(0, WC_LISTVIEW, L, WS_CHILD | WS_VISIBLE | LVS_REPORT, 0, 0, 500, 400, hWnd, (HMENU)ID_LISTVIEW, hInst, NULL); Допустим, он.
Я установил свой Listview так, чтобы он выглядел так же, как Windows Explorer, используя SetWindowTheme API, но при этом он также рисует вертикальные линии под заголовками столбцов. Есть ли шанс.
Последние три версии Windows имели полупрозрачные эффекты подсветки и наведения в Windows Explorer listview: Используя тему explorer , я вижу, что ListItem не имеет состояния, соответствующего тому.
Walkthrough: Creating an Explorer Style Interface with the ListView and TreeView Controls Using the Designer
One of the benefits of Visual Studio is the ability to create professional-looking Windows Forms applications in a short of amount of time. A common scenario is creating a user interface (UI) with ListView and TreeView controls that resembles the Windows Explorer feature of Windows operating systems. Windows Explorer displays a hierarchical structure of the files and folders on a user’s computer.
To create the form containing a ListView and TreeView control
On the File menu, point to New, and then click Project.
In the New Project dialog box, do the following:
In the categories, choose either Visual Basic or Visual C#.
In the list of templates, choose Windows Forms Application.
Click OK. A new Windows Forms project is created.
Add a SplitContainer control to the form and set its Dock property to Fill.
Add an ImageList named imageList1 to the form and use the Properties window to add two images: a folder image and a document image, in that order.
Add a TreeView control named treeview1 to the form, and position it on the left side of the SplitContainer control. In the Properties window for treeView1 do the following:
Set the Dock property to Fill.
Set the ImageList property to imagelist1.
Add a ListView control named listView1 to the form, and position it on the right side of the SplitContainer control. In the Properties window for listview1 do the following:
Set the Dock property to Fill.
Set the View property to Details.
Open the ColumnHeader Collection Editor by clicking the ellipses ( ) in the Columns property**.** Add three columns and set their Text property to Name , Type , and Last Modified , respectively. Click OK to close the dialog box.
Set the SmallImageList property to imageList1.
Implement the code to populate the TreeView with nodes and subnodes. Add this code to the Form1 class.
Since the previous code uses the System.IO namespace, add the appropriate using or import statement at the top of the form.
Call the set-up method from the previous step in the form’s constructor or Load event-handling method. Add this code to the form constructor.
Handle the NodeMouseClick event for treeview1 , and implement the code to populate listview1 with a node’s contents when a node is clicked. Add this code to the Form1 class.
If you are using C#, make sure you have the NodeMouseClick event associated with its event-handling method. Add this code to the form constructor.
Testing the Application
You can now test the form to make sure it behaves as expected.
To test the form
Press F5 to run the application.
You will see a split form containing a TreeView control that displays your project directory on the left side, and a ListView control on the right side with three columns. You can traverse the TreeView by selecting directory nodes, and the ListView is populated with the contents of the selected directory.
Next Steps
This application gives you an example of a way you can use TreeView and ListView controls together. For more information on these controls, see the following topics:
Общие сведения об элементе управления ListView (Windows Forms) ListView Control Overview (Windows Forms)
Элемент управления ListView Windows Forms отображает список элементов со значками. The Windows Forms ListView control displays a list of items with icons. Представление списка можно использовать для создания пользовательского интерфейса, аналогичного правой области окна проводника. You can use a list view to create a user interface like the right pane of Windows Explorer. Элемент управления имеет четыре режима представления: LargeIcon, маленькие значки, List и Details. The control has four view modes: LargeIcon, SmallIcon, List, and Details.
Что можно сделать с помощью элемента управления ListView What You Can Do with the ListView Control
Дополнительный режим просмотра, плитка, доступен только в Windows XP и операционной системе Windows Server 2003. An additional view mode, Tile, is only available on Windows XP and the Windows Server 2003 operating system. Дополнительные сведения см. в разделе инструкции. Включение мозаичного представления в Windows Forms элементе управления ListView. For more information, see How to: Enable Tile View in a Windows Forms ListView Control.
В режиме LargeIcon рядом с текстом элемента отображаются крупные значки. элементы отображаются в нескольких столбцах, если элемент управления достаточно большой. The LargeIcon mode displays large icons next to the item text; the items appear in multiple columns if the control is large enough. Режим маленькие значки одинаковый, за исключением того, что он отображает небольшие значки. The SmallIcon mode is the same except that it displays small icons. Режим списка отображает небольшие значки, но всегда находится в одном столбце. The List mode displays small icons but is always in a single column. В режиме подробностей отображаются элементы в нескольких столбцах. The Details mode displays items in multiple columns. Дополнительные сведения см. в разделе инструкции. Добавление столбцов в Windows Forms элемент управления ListView. For details, see How to: Add Columns to the Windows Forms ListView Control. Режим просмотра определяется View свойством. The view mode is determined by the View property. Все режимы просмотра могут отображать изображения из списков изображений. All of the view modes can display images from image lists. Дополнительные сведения см. в разделе как отображать значки для элемента управления ListView Windows Forms. For details, see How to: Display Icons for the Windows Forms ListView Control.
В следующей таблице перечислены некоторые ListView элементы и представления, которые они являются допустимыми. The following table lists some of the ListView members and the views they are valid in.
Элемент ListView ListView member | Просмотр View |
---|---|
СвойствоAlignment Alignment property | SmallIcon либо LargeIcon SmallIcon or LargeIcon |
СвойствоAutoArrange AutoArrange property | SmallIcon либо LargeIcon SmallIcon or LargeIcon |
Метод AutoResizeColumn AutoResizeColumn method | Details |
СвойствоColumns Columns property | Details либо Tile Details or Tile |
СобытиеDrawSubItem DrawSubItem event | Details |
Метод FindItemWithText FindItemWithText method | Details, Listили Tile Details, List, or Tile |
Метод FindNearestItem FindNearestItem method | SmallIcon либо LargeIcon SmallIcon or LargeIcon |
Метод GetItemAt GetItemAt method | Details либо Tile Details or Tile |
СвойствоGroups Groups property | Все представления, Кроме List All views except List |
СвойствоHeaderStyle HeaderStyle property | Details. Details. |
СвойствоInsertionMark InsertionMark property | LargeIcon, SmallIconили Tile LargeIcon, SmallIcon, or Tile |
Ключевым свойством ListView элемента управления является Items , который содержит элементы, отображаемые элементом управления. The key property of the ListView control is Items, which contains the items displayed by the control. SelectedItemsСвойство содержит коллекцию элементов, выбранных в данный момент в элементе управления. The SelectedItems property contains a collection of the items currently selected in the control. Пользователь может выбрать несколько элементов, например, чтобы перетащить несколько элементов за раз в другой элемент управления, если MultiSelect свойство имеет значение true . The user can select multiple items, for example to drag and drop several items at a time to another control, if the MultiSelect property is set to true . ListViewЭлемент управления может отображать флажки рядом с элементами, если CheckBoxes свойство имеет значение true . The ListView control can display check boxes next to the items, if the CheckBoxes property is set to true .
ActivationСвойство определяет тип действия, которое пользователь должен предпринять для активации элемента в списке: Standard , OneClick и TwoClick . The Activation property determines what type of action the user must take to activate an item in the list: the options are Standard, OneClick, and TwoClick. OneClick для активации элемента требуется одно нажатие кнопки. OneClick activation requires a single click to activate the item. TwoClick Активация требует, чтобы пользователь дважды щелкнул элемент, чтобы активировать его. один щелчок изменяет цвет текста элемента. TwoClick activation requires the user to double-click to activate the item; a single click changes the color of the item text. Standard Активация требует, чтобы пользователь дважды щелкнул, чтобы активировать элемент, но элемент не изменит внешний вид. Standard activation requires the user to double-click to activate an item, but the item does not change appearance.
ListViewЭлемент управления также поддерживает стили оформления и другие возможности, доступные на платформе Windows XP, включая группирование, мозаичное представление и метки вставки. The ListView control also supports the visual styles and other features available on the Windows XP platform, including grouping, tile view, and insertion marks.
Элемент управления ListView (Windows Forms) ListView Control (Windows Forms)
Элемент управления ListView Windows Forms отображает список элементов со значками. The Windows Forms ListView control displays a list of items with icons. Представление списка можно использовать для создания пользовательского интерфейса, аналогичного правой области окна проводника. You can use a list view to create a user interface like the right pane of Windows Explorer.
в этом разделе In This Section
Общие сведения об элементе управления ListView ListView Control Overview
Описывается элемент управления, его основные возможности и свойства. Describes this control and its key features and properties.
Практическое руководство. Добавление столбцов в элемент управления ListView в Windows Forms How to: Add Columns to the Windows Forms ListView Control
Описывается, как создавать столбцы для вывода сведений о каждом элементе списка. Describes how to create columns in order to display information about each list item.
Практическое руководство. Отображение значков в элементе управления ListView в Windows Forms How to: Display Icons for the Windows Forms ListView Control
Описывается, как связать представление списка с соответствующим списком изображений для отображения крупных или мелких значков. Describes how to associate a list view with an appropriate image list for displaying large or small icons.
Практическое руководство. Группирование элементов в элементе управления ListView в формах Windows Forms How to: Group Items in a Windows Forms ListView Control
Описывается, как создать группы для отображения по категориям и как назначить элементы каждой группе. Describes how to create groups for categorized display and how to assign items to each group.
Практическое руководство. Отображение содержимого элемента управления ListView в Windows Forms в виде мозаичного представления How to: Enable Tile View in a Windows Forms ListView Control
Описывается, как отобразить элементы в виде плиток, каждая из которых состоит из большого значка и нескольких строк текста. Describes how to display items as tiles, each of which is comprised of a large icon and multiple lines of text.
Практическое руководство. Индикация места вставки в элементе управления ListView в Windows Forms How to: Display an Insertion Mark in a Windows Forms ListView Control
Описывается, как реализовать обратную связь с пользователем при выполнении операций перетаскивания, в ходе которых метка вставки указывает место перетаскивания для каждого положения указателя мыши. Describes how to implement user-feedback for drag-and-drop operations in which an insertion mark indicates the drop location for each mouse-pointer position.
Практическое руководство. Добавление в элемент управления ListView возможностей поиска How to: Add Search Capabilities to a ListView Control
Описывается, как программным способом найти элемент с помощью текстового поиска или экранных координат. Describes how to programmatically find an item using either text search or screen coordinates.
Справочник Reference
Класс ListView ListView class
Описание класса и всех его членов. Describes this class and has links to all its members.
Связанные разделы Related Sections
Практическое руководство. Добавление пользовательских данных в элемент управления TreeView или ListView (Windows Forms) How to: Add Custom Information to a TreeView or ListView Control (Windows Forms)
Описывается, как выполнять наследование от элемента в представлении списка или узла дерева для добавления любых необходимых полей, методов или конструкторов. Describes how to inherit from an item in a list view or a node in a tree view in order to add any fields, methods, or constructors you need.
Компонент ImageList ImageList Component
Описание списка изображений, его основных возможностей и свойств. Explains what an image list is and its key features and properties.