-1
using System.Xml;
using System.IO;
namespace Ebookss
{
public partial class Ebook : Form
{
string path = "D:\\samples";
public Ebook()
{
InitializeComponent();
listdirectory(treeView1, path);
}
private void listdirectory(TreeView treeview, string path)
{
treeview.Nodes.Clear();
var treeviewinfo = new DirectoryInfo(path);
treeview.Nodes.Add(createDN(treeviewinfo));
}
private static TreeNode createDN(DirectoryInfo directoryinfo)
{
var directorynode = new TreeNode(directoryinfo.Name);
foreach (var directory in directoryinfo.GetDirectories())
{
directorynode.Nodes.Add(createDN(directory));
}
foreach (var file in directoryinfo.GetFiles())
{
directorynode.Nodes.Add(new TreeNode(file.Name));
}
return directorynode;
}
private void homeToolStripMenuItem_Click(object sender, EventArgs e)
{
string treenodename = treeView1.SelectedNode.ToString().Replace("TreeNode:", string.Empty);
MessageBox.Show(path + "\\" + treenodename);
this.adobe.LoadFile(path + "\\" + treenodename);
}
public object fileUri { get; set; }
}
}
謝謝你的工作.. –
很高興幫助,如果這個答案解決了你的問題,請點擊答案旁邊的複選標記標記爲已接受。請參閱:[如何接受答案工作?](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work)以獲取更多信息 –
先生,我需要禁用右鍵單擊並出於安全原因在Windows窗體中隱藏工具欄? –