示例#1
0
        public void ResizeProtect()
        {
            SizeF s = Fonts.MeasureString(Node.protectedName, this.font);

            s.Height += 2 * Node.NodePadding;
            s.Width  += 2 * Node.NodePadding;

            this.width  = (int)s.Width;
            this.height = (int)s.Height;
        }
示例#2
0
        private void SetPanelSize()
        {
            int padding = Node.NodePadding;

            SizeF s = Fonts.MeasureString(this.edit.Text == "" ? "X" : this.edit.Text, this.edit.Font);

            this.edit.Height = (int)Math.Round(s.Height, 0) + 2 * padding;
            this.Height      = this.edit.Height;

            this.edit.Width = (int)Math.Round(s.Width, 0) + padding;
            this.Width      = this.edit.Width;
        }
示例#3
0
        public SizeF Measure()
        {
            SizeF s;

            if (name != "")
            {
                s         = Fonts.MeasureString((this.protect) ? Node.protectedName : this.name, this.font);
                s.Height += 2 * Node.NodePadding;
                s.Width  += 2 * Node.NodePadding;
            }
            else
            {
                s = new SizeF(Node.EmptyNodePadding, Node.EmptyNodePadding);
            }

            return(s);
        }
        public void Update() //UID2139429132
        {
            this.width     = 0;
            this.height    = 0;
            this.isVisible = false;

            if (this.diagramView.layersHistory != null &&
                this.diagramView.layersHistory.Count > 1)
            {
                this.items.Clear();

                long i = 0;
                foreach (Layer layer in this.diagramView.layersHistory)
                {
                    //skip first top layer because logo is showed insted
                    if (i++ == 0)
                    {
                        continue;
                    }

                    BreadcrumbItem item = new BreadcrumbItem();

                    if (layer.parentNode != null)
                    {
                        item.name = layer.parentNode.name;
                    }
                    else
                    {
                        item.name = "Home";
                    }

                    if (item.name.Length > 10)
                    {
                        item.name = item.name.Substring(0, 9);
                    }

                    SizeF s = Fonts.MeasureString(item.name, this.font);
                    item.left   = this.width;
                    item.top    = 0;
                    item.height = (int)s.Height;
                    item.width  = (int)s.Width;
                    this.width += item.width + itemSpace;

                    if (this.height < item.height)
                    {
                        this.height = item.height;
                    }

                    item.layerId = layer.id; // for restore layer after click

                    this.items.Add(item);
                }

                // add logo width
                this.width += this.height;

                // add logo width to items
                foreach (BreadcrumbItem item in items)
                {
                    item.left += this.height;
                }

                this.isVisible = true;
            }
        }