Esempio n. 1
0
 private void DrawIndentBackground(Graphics g, Rectangle r, TreeListView.Branch br)
 {
     using (Brush brush = new SolidBrush(ListView.BackColor))
     {
         g.FillRectangle(brush, r.X - 1, r.Y - 1, (br.Level * PIXELS_PER_LEVEL) + 20, r.Height + 2);
     }
 }
Esempio n. 2
0
            protected override void DrawLines(Graphics g, Rectangle r, Pen p, TreeListView.Branch br, int glyphMidVertical)
            {
                bool mustRevert = IndentAmount != PIXELS_PER_LEVEL;

                PIXELS_PER_LEVEL = IndentAmount;
                base.DrawLines(g, r, p, br, glyphMidVertical);
                if (mustRevert)
                {
                    PIXELS_PER_LEVEL = 17;
                }
            }
Esempio n. 3
0
        protected override void DrawLines(Graphics g, Rectangle r, Pen p, TreeListView.Branch br, int glyphMidVertical)
        {
            if (br.Level <= 1)
            {
                return;
            }

            Rectangle rectangle = r;

            rectangle.Width = PIXELS_PER_LEVEL;
            int top = rectangle.Top;
            IList <BrightIdeasSoftware.TreeListView.Branch> ancestors = br.Ancestors;
            int num;

            foreach (BrightIdeasSoftware.TreeListView.Branch item in ancestors)
            {
                if (!item.IsLastChild && !item.IsOnlyBranch)
                {
                    num = rectangle.Left + rectangle.Width / 2;
                    if (item.Level > 1)
                    {
                        g.DrawLine(p, num, top, num, rectangle.Bottom);
                    }
                }
                rectangle.Offset(PIXELS_PER_LEVEL, 0);
            }
            num = rectangle.Left + rectangle.Width / 2;
            g.DrawLine(p, num, glyphMidVertical, rectangle.Right, glyphMidVertical);
            if (br.IsFirstBranch)
            {
                if (!br.IsLastChild && !br.IsOnlyBranch && br.Level > 1)
                {
                    g.DrawLine(p, num, glyphMidVertical, num, rectangle.Bottom);
                }
            }
            else if (br.IsLastChild)
            {
                g.DrawLine(p, num, top, num, glyphMidVertical);
            }
            else
            {
                g.DrawLine(p, num, top, num, rectangle.Bottom);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Navigates to the last selected folder.
        /// </summary>
        private void NavigateTree()
        {
            string lastPath = Configuration.LastRootPath;

            if (lastPath != null)
            {
                string[] lastpathparts = lastPath.Split(new char[] { Path.DirectorySeparatorChar });

                ListViewItem item = this.treeListViewRootPath.FindItemWithText(lastpathparts[0], false, 0);

                if (item != null)
                {
                    TreeListView.Branch branch = treeListViewRootPath.TreeModel.GetBranch(treeListViewRootPath.GetModelObject(item.Index));
                    treeListViewRootPath.Expand(branch.Model);
                    for (int X = 1; X <= lastpathparts.Length - 1; X++)
                    {
                        int newModelChild = -1;
                        for (int child = 0; child <= branch.ChildBranches.Count - 1; child++)
                        {
                            if (((MyFileSystemInfo)branch.ChildBranches[child].Model).Name == lastpathparts[X])
                            {
                                treeListViewRootPath.Expand(branch.ChildBranches[child].Model);          //*Expand this branch/child
                                newModelChild = child;                                                   //*Gives place in ArrayList that is the branch-directory that was just expanded

                                treeListViewRootPath.SelectedObject = branch.ChildBranches[child].Model; //Select the folders as we go down.
                                break;
                            }
                        }
                        if (newModelChild == -1)
                        {
                            break;
                        }
                        branch = treeListViewRootPath.TreeModel.GetBranch(branch.ChildBranches[newModelChild].Model); //*New branch to go into loop with
                    }
                }
            }
        }