Esempio n. 1
0
        private void SetNodesFromPath(string value)
        {
            this.Nodes.Clear();
            StringBuilder tpath = new StringBuilder();

            foreach (string s in value.Split(new string[] { this.PathSeparator }, StringSplitOptions.RemoveEmptyEntries))
            {
                tpath.AppendFormat("{0}{1}", s, this.PathSeparator);
                this.Nodes.Add(new BreadcrumbBarNode(s, delegate(object sender, EventArgs e) {
                    BreadcrumbBarNode item = sender as BreadcrumbBarNode;
                    OnNodeClicked(new BreadcrumbBarNodeClickedEventArgs(item));
                }, tpath));
            }

            this.Invalidate();
        }
Esempio n. 2
0
 internal int CalculateNodeWidth(BreadcrumbBarNode node)
 {
     using (Graphics g = node.CreateGraphics()) {
         return((int)g.MeasureString(
                    node.Text,
                    node.Font,
                    new SizeF(
                        Owner.Width, Owner.Height),
                    node.GetStringFormat()).Width +
                (node.HasChildNodes ? node.DropDownBounds.Width : 0) +
                (node is BreadcrumbBarRootNode ?
                 (node as BreadcrumbBarRootNode).ImageBounds.Width +
                 (node as BreadcrumbBarRootNode).ImageBounds.X + 2 :
                 8
                ));
     }
 }
Esempio n. 3
0
            public override void Clear()
            {
                lock ( nodes ) {
                    for (int i = 0; i < this.nodes.Count; i++)
                    {
                        BreadcrumbBarNode item = this.nodes[i];
                        //if ( item.Equals ( ( this.Owner as BreadcrumbBar ).Root ) || item is BreadcrumbBarRootNode ) {
                        //	continue;
                        //} else {
                        Owner.Controls.Remove(item);

                        //}
                    }
                    //BreadcrumbBarRootNode root = ( this.Owner as BreadcrumbBar ).Root.Clone () as BreadcrumbBarRootNode;
                    nodes.Clear();
                    //( this.Owner as BreadcrumbBar ).Root = root;
                    //this.nodes.Add ( root );
                }
            }
Esempio n. 4
0
            public override void Add(Control value)
            {
                lock ( nodes ) {
                    if (value is BreadcrumbBarNode)
                    {
                        BreadcrumbBarNode v = value as BreadcrumbBarNode;
                        v.Height = this.Owner.Height - 2;
                        v.Width  = CalculateNodeWidth(v);
                        int w = (Owner as BreadcrumbBar).Root.Width + 1;

                        foreach (var item in nodes)
                        {
                            w += item.Width;
                        }

                        v.Left   = w;
                        v.Top    = 1;
                        v.Parent = Owner as BreadcrumbBar;
                        nodes.Add(v);
                        Owner.Controls.Add(v);
                    }
                }
            }
 public BreadcrumbBarNodeClickedEventArgs(BreadcrumbBarNode node) : base()
 {
     this.Node = node;
 }