Esempio n. 1
0
        private void AddFolders(ref int tp, int fontHeight)
        {
            if (_directory == null) return;
            string temp = _directory.Trim(Path.DirectorySeparatorChar);
            string[] currentDirectoryParts = temp.Split(Path.DirectorySeparatorChar);

            if (currentDirectoryParts.Length > 1)
            {
                if (_directory != null)
                {
                    DirectoryInfo parent = System.IO.Directory.GetParent(_directory);
                    if (parent != null)
                    {
                        FolderItem up = new FolderItem(parent.FullName);

                        up.Text = "..";
                        up.Font = this.Font;
                        up.Top = tp;
                        up.Height = fontHeight;
                        _items.Add(up);
                    }
                }
                tp += fontHeight;
            }

            if (_directory != null)
            {
                string[] subDirs = System.IO.Directory.GetDirectories(_directory);
                if (_items == null) _items = new List<DirectoryItem>();
                foreach (string dir in subDirs)
                {
                    FolderItem di = new FolderItem(dir);
                    di.Font = this.Font;
                    di.Top = tp;
                    di.Height = fontHeight;
                    //di.Navigate += new EventHandler<NavigateEventArgs>(item_Navigate);
                    //di.SelectChanged += new EventHandler<SelectEventArgs>(item_SelectChanged);
                    _items.Add(di);
                    tp += fontHeight;
                }
            }
        }