コード例 #1
0
        void Populate()
        {
            string Desktop = System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);

            FileSystemNode desk = new FileSystemNode("Desktop", Desktop, false, "desktop", m_ShowFiles);

            desk.IsDesktop = true;

            m_SysTree.Nodes.Add(desk);

            string mydocs = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            FileSystemNode docs = new FileSystemNode("MyDocuments", mydocs, true, "mydocs", m_ShowFiles);

            desk.Nodes.Add(docs);

            //	int index = 3;
//
            //Icon ico = Icon.ExtractAssociatedIcon("c:\\windows\\Explorer.exe",index);

            //Bitmap bmp = ico.ToBitmap();

            m_SysTree.ImageList.Images.Add("desktop", Properties.Resources.desktop);

            //	ico = Icon.ExtractAssociatedIcon("c:\\windows\\Explorer.exe", index);

            m_SysTree.ImageList.Images.Add("mydocs", Properties.Resources.folder_document);
            m_SysTree.ImageList.Images.Add("folder", Properties.Resources.folder);

            m_SysTree.ImageList.Images.Add("hd", Properties.Resources.diskdrive);
            m_SysTree.ImageList.Images.Add("cdrom", Properties.Resources.cd);
            m_SysTree.ImageList.Images.Add("network", Properties.Resources.harddisk_network);

            DriveInfo[] drives = DriveInfo.GetDrives();

            foreach (DriveInfo drive in drives)
            {
                desk.Nodes.Add(new DriveNode(drive));
            }


            desk.Expand();
        }
コード例 #2
0
		void Populate()
		{
			string Desktop = System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);

			FileSystemNode desk = new FileSystemNode("Desktop", Desktop, false, "desktop", m_ShowFiles);			
		
			desk.IsDesktop = true;

			m_SysTree.Nodes.Add(desk);

			string mydocs = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

			FileSystemNode docs = new FileSystemNode("MyDocuments", mydocs, true, "mydocs", m_ShowFiles);

			desk.Nodes.Add(docs);

		//	int index = 3;
//
			//Icon ico = Icon.ExtractAssociatedIcon("c:\\windows\\Explorer.exe",index);

			//Bitmap bmp = ico.ToBitmap();

			m_SysTree.ImageList.Images.Add("desktop", Properties.Resources.desktop);

		//	ico = Icon.ExtractAssociatedIcon("c:\\windows\\Explorer.exe", index);

			m_SysTree.ImageList.Images.Add("mydocs", Properties.Resources.folder_document);
			m_SysTree.ImageList.Images.Add("folder", Properties.Resources.folder);

			m_SysTree.ImageList.Images.Add("hd", Properties.Resources.diskdrive);
			m_SysTree.ImageList.Images.Add("cdrom", Properties.Resources.cd);
			m_SysTree.ImageList.Images.Add("network", Properties.Resources.harddisk_network);

			DriveInfo[] drives = DriveInfo.GetDrives();

			foreach (DriveInfo drive in drives)
			{
				desk.Nodes.Add(new DriveNode(drive));
			}
			

			desk.Expand();
		}