Friday, April 29, 2011

Window form "window explorer" emulator

Hướng dẫn sử dụng listview và treeview trên window form


Trong bài này tổi hướng dẫn các bạn sử dụng form để liệt kê hệ thống tập tin và thư mục trên một máy tính

  1. Sử dụng listview hiển thị danh sách tập tin

  2. Sử dụng treeview hiển thị cây thư mục

  3. Sử dụng lớp Directory, Path và File của C# để dò tim hệ thống tập tin thư mục


Hình demo
[caption id="attachment_259" align="aligncenter" width="300" caption="ListView TreeView Window Explorer"]ListView TreeView Window Explorer[/caption]

Sử dụng sự kiện load của form để lấy ds ổ đĩa


Sử dụng sự kiện BeforeSelect của treeView để gán thư mục con và file vào listview

Download source ở đây

2 comments:

Translate