Exemplo n.º 1
0
        public TreeListNode()
        {
            subitems = new ContainerSubListViewItemCollection();
            subitems.ItemsChanged += new ItemsChangedEventHandler(OnSubItemsChanged);

            nodes = new TreeListNodeCollection();
            nodes.Owner = this;
            nodes.MouseDown += new MouseEventHandler(OnSubNodeMouseDown);
        }
Exemplo n.º 2
0
        public TreeListView()
            : base()
        {
            virtualParent = new TreeListNode();

            nodes = virtualParent.Nodes;
            nodes.Owner = virtualParent;
            nodes.MouseDown += new MouseEventHandler(OnSubControlMouseDown);
            nodes.NodesChanged += new EventHandler(OnNodesChanged);

            selectedNodes = new TreeListNodeCollection();

            nodeRowRects = new ListDictionary();
            pmRects = new ListDictionary();

            // Use reflection to load the
            // embedded bitmaps for the
            // styles plus and minus icons
            Assembly myAssembly = Assembly.GetAssembly(Type.GetType("ExtendedListView.Forms.TreeListView"));
            Stream bitmapStream1 = myAssembly.GetManifestResourceStream("ExtendedListView.Forms.Resources.tv_minus.bmp");
            bmpMinus = new Bitmap(bitmapStream1);

            Stream bitmapStream2 = myAssembly.GetManifestResourceStream("ExtendedListView.Forms.Resources.tv_plus.bmp");
            bmpPlus = new Bitmap(bitmapStream2);
        }
Exemplo n.º 3
0
        private TreeListNodeCollection GetSelectedNodes(TreeListNode node)
        {
            TreeListNodeCollection list = new TreeListNodeCollection();

            for (int i=0; i<node.Nodes.Count; i++)
            {
                // check if current node is selected
                if (node.Nodes[i].Selected)
                {
                    list.Add(node.Nodes[i]);
                }

                // chech if node is expanded and has
                // selected children
                if (node.Nodes[i].IsExpanded)
                {
                    TreeListNodeCollection list2 = GetSelectedNodes(node.Nodes[i]);
                    for (int j=0; j<list2.Count; j++)
                    {
                        list.Add(list2[i]);
                    }
                }
            }

            return list;
        }
Exemplo n.º 4
0
 private void UnselectNodes(TreeListNodeCollection nodecol)
 {
     for (int i=0; i<nodecol.Count; i++)
     {
         UnselectNodes(nodecol[i].Nodes);
         nodecol[i].Focused = false;
         nodecol[i].Selected = false;
     }
 }
Exemplo n.º 5
0
        private void AutoSetColWidth(TreeListNodeCollection nodes, ref int mwid, ref int twid, int i)
        {
            for (int j=0; j<nodes.Count; j++)
            {
                if (i > 0 && nodes[j].SubItems[i - 1]!=null)
                    twid = GetStringWidth(nodes[j].SubItems[i-1].Text);
                else
                    twid = GetStringWidth(nodes[j].Text);
                twid += 5;
                if (twid > mwid)
                    mwid = twid;

                if (nodes[j].Nodes.Count > 0)
                {
                    AutoSetColWidth(nodes[j].Nodes, ref mwid, ref twid, i);
                }
            }
        }